Jump to content
Sign in to follow this  
Hafedh TRIMECHE

C variable from delphi

Recommended Posts

Hello,

 

Having a c module exporting a structured variable as:
 

typedef struct params{

  int p1;

  int p2;

} PARAMS;

and is exported as:

extern PARAMS params;

 

Please, how a function be called from Delphi to retrieve params?

 

Best regards.

 

Share this post


Link to post

The Delphi program folder contains a console program named tdump.exe (and tdump64.exe for 64 bit executables) that you can use to examine the segments of the C DLL. Look for the exports table and check whether there is an entry for this params variable. If there is you can load the DLL from Delphi (LoadLibrary) and retrieve the address of this export via GetProcAddress, like for an exported function. Store the returned address into a variable of a suitably defined pointer type and you can access the value of the variable.

  • Like 1

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
Sign in to follow this  

×