Link to home
Start Free TrialLog in
Avatar of mebarron
mebarron

asked on

Delphi DLL called from Delphi and then from C

The DLL has two entry points
Func1 and Func2. Delphi Exe calls
Func1 which opens a file and writes to it, it works.
I want to call Func2 from C and append to the
same file.
I have :

Procedure func2(Param: PChar): PChar; stdcall;
     external ;
 
export
 func1 index 1,
 func2 index 2;
 
 From C do I just do:
   int func2(char*);
            ....
   nRet = func2("Hi Mom!");
   
   Any tips? What statement goes in the C code
to reference the DLL - here by number;
   
   Many Thanks , Mark
Avatar of robert_marquardt
robert_marquardt

In C you will have to generate the .lib file to statically link to.
Also your C declaration needs a declspec(dllimport) to force the stdcall calling convention.
Avatar of mebarron

ASKER

I do not understand your first sentence.How
do I statically generate a .lib file?
ASKER CERTIFIED SOLUTION
Avatar of robert_marquardt
robert_marquardt

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
many thanks