Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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:

  1. Use only C or C style code, do yourself a favour and surround the module with

#ifdef __cplusplus
extern "C"
{
//header file
}
#endif //__cplusplus

This guarantees that the code compiles into the C ABI

  1. it is advisable to make the functions __stdcall

  2. 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)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top