I have a really old (Photoshop SDK for Delphi from Centaurix Interactive) component set. We could recompile it and successfully use it in our application without any problem. But it has started to create an access violation when we upgrade to Delphi 11.
If I change the line for memory allocation from
new(Stub)
to Stub:= VirtualAlloc(nil, SizeOf(TStub), MEM_COMMIT, PAGE_EXECUTE_READWRITE)
it works at first, but it creates several 'memory problems' during further operations...
what's the reason for this issue, and is there any compiler directive or workaround to fix this?
Update : It is a Windows 32bit application and it could work with delphi 10.3 so it supports unicode.
CodePudding user response:
I found the reason for this issue. it is not directly creating memory allocation but about creating a stub function for dll. Several PE security flags have been introduced in Delphi 11. you can find the details in Marco Cantu's blog. One of them, DEP flag, apparently prevents some memory operations. If I uncheck it, the application works pretty well.