Jump to content
direktor05

DLL access error

Recommended Posts

Hello,

 

Im calling a DLL written in Delphi, when exiting form I get Access Error. How to deal with debugging of this kind of errors when you don't know exactly what is wrong but only get memory location access error? I think there is a problem with memory management, loading and unloading, creating and destroying components. But where....? Are there any tools to better analyze this? I'm using Delphi 11.3

 

Help is very welcome.

Share this post


Link to post
3 hours ago, David Heffernan said:

You can debug the dll, assuming you have the source code

Yes I have, same thing - access error is still there. not knowing where it came from no matter what you debug.

Share this post


Link to post
3 hours ago, Lajos Juhász said:

During the debug you must get a call stack.

right with not much info. the is the CPU window with a lot of assembler code to dig through

Share this post


Link to post
22 hours ago, direktor05 said:

Hello,

 

Im calling a DLL written in Delphi, when exiting form I get Access Error. How to deal with debugging of this kind of errors when you don't know exactly what is wrong but only get memory location access error? I think there is a problem with memory management, loading and unloading, creating and destroying components. But where....? Are there any tools to better analyze this? I'm using Delphi 11.3

 

Help is very welcome.

Are you calling the DLL from a Delphi app or some other environment?

Anyway, even if you use a DLL from a host app made with the same Delphi version it is not safe to pass data types to the DLL for which the compiler does automatic memory management (string, dynamic arrays, objects that internally use such data types, e.g. TStringlist). At minimum you have to use the SimpleShareMem or ShareMem unit on both sides to get both modules to use the same memory manager. This may not be enough if the DLL implements forms or datamodules, since these use global VCL variables like Application and Screen, of which each module has its own instance. The only way to make both modules share the same VCL instance is to build both with the core RTL and VCL run-time packages.

Share this post


Link to post
On 4/30/2024 at 8:53 PM, PeterBelow said:

Are you calling the DLL from a Delphi app or some other environment?

Anyway, even if you use a DLL from a host app made with the same Delphi version it is not safe to pass data types to the DLL for which the compiler does automatic memory management (string, dynamic arrays, objects that internally use such data types, e.g. TStringlist). At minimum you have to use the SimpleShareMem or ShareMem unit on both sides to get both modules to use the same memory manager. This may not be enough if the DLL implements forms or datamodules, since these use global VCL variables like Application and Screen, of which each module has its own instance. The only way to make both modules share the same VCL instance is to build both with the core RTL and VCL run-time packages.

and you too!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×