[fpc-pascal] Linking Pascal code to C/C++ static libraries under Windows.

Marco van de Voort marcov at stack.nl
Tue Aug 16 19:58:44 CEST 2005


> 
> The Problem:
> 
> The problem is that I can't seem to figure out how to get FPC to link to 
> static libraries.  FPC's linker won't look for the "Wrapper.lib".  It 
> either wants "Wrapper.dll" or "Wrapper.lib.dll".  I can compile wrapper.c 
> to an object module (in Visual C 6.0) and FPC will link to that object 
> file. 

FPC is link compatible with GCC, not with VC. IOW, recompile your sources
with GCC.

> get the linker to see the "Interface.lib" files that contain them.  I've 
> tried setting up my wrapper module as a DLL  but haven't had much luck 
> there (I suspect the problem is that I'm not correctly creating the DLL in 
> the first place since I can't get another test C program to link to it.)

This should be possible though, as long as you refrain from memory
allocation across processes (iow the program should have to free memory
allocated by the dll, call a dll function to free)
 
> Any suggestions?

Can't offer any real advice with the limited info, but my suggestion is to
get the dll working. As soon as this works in general, it will work with
FPC too.




More information about the fpc-pascal mailing list