[fpc-pascal]Linking with C

Michael.VanCanneyt at Wisa.be Michael.VanCanneyt at Wisa.be
Sun Sep 29 11:16:54 CEST 2002


On Sun, 29 Sep 2002, John Coppens wrote:

> Hi all.
>
> I was trying to link with a C library, and everything went well till one
> function popped up that didn't wan't to work. Till I investigated the
> source library code, and found that it was in fact a macro that referenced
> fields from a struct.
>
> The only solution I found, was to write a few C functions that call the
> macro, then I link to that C proggie. Hardly elegant... Is there a another
> solution to this?

No. When we translate C library header files, we rewrite the macros always
as pascal functions. The h2pas conversion tool takes a shot at this, but
the translation always needs to be hand-tweaked.

Michael.






More information about the fpc-pascal mailing list