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
mebarronAsked:
Who is Participating?
 
robert_marquardtConnect With a Mentor Commented:
You will need to generate a .lib file from the DLL.
There is a tool somewhere with your C++ compiler. Maybe the project automatically generates it already (i am not used to modern C++ compilers).
To use the DLL you add the .lib file to the files the linker should link in.
0
 
robert_marquardtCommented:
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.
0
 
mebarronAuthor Commented:
I do not understand your first sentence.How
do I statically generate a .lib file?
0
 
mebarronAuthor Commented:
many thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.