Reputation: 8614
if I have a source of library written in C/C++ (lets say its libxml2), now I'd like to build it, and link it into the delphi application... I know it is possible, since Delphi Zlib does it ( http://www.dellapasqua.com/delphizlib/ ) ... But my question is, how to prepare those .obj files?
Thanks in advance m.
Upvotes: 4
Views: 3407
Reputation: 28872
If you create a dll that adheres to the C Application Binary Interface (ABI), you can dynamically link to it from either a C++ or a Delphi Application.
It is advisable that you do the the following:
#ifdef __cplusplus extern "C" { //header file } #endif //__cplusplus
This guarantees that the code compiles into the C ABI
it is advisable to make the functions __stdcall
Compile the function as a dll
from here you should be able to link to the dll in the same way that Delphi can link to any windows DLL. (I can't remember what needs to be done from the Delphi side)
Upvotes: 1
Reputation: 43602
You would need to use CodeGear's C++ compiler to produce compatible obj files for Delphi. Does your Delphi come with C++ Builder? Otherwise you could try the free (Borland) commandline version. Read more about this subject here.
Upvotes: 6