[fpc-pascal] Linking statically C code with stdcall functions

Marco van de Voort marcov at stack.nl
Fri Mar 5 15:36:14 CET 2010

In our previous episode, Henry Vermaak said:
> >> > I'd just add the decoration manually. It is typically a one-off effort.
> >>
> >> Except if you have cross platform code, then you need an ifdef for
> >> every function you import :(
> >
> > It's still a one off. Annoying for hundreds of calls, but not really a
> > problem for a few tens. It will be more work to craete a patch to fix this
> > :-)
> Is this a big task?  I've never looked at the code for the linker.

I'm no inner-compiler developer, but it probably depends on what you want to
do.  Just fuzzy linking trying to match undecorated functions with decorated
ones, or really evaluate the number of arguments to create the decoration on
the "header" side, and then do exact linking.

The fuzzy option is easier, but the other stuff is probably also needed for
generating libs with compatible decoration, as well as making use of the
main use of decoration: overloading external symbols on the basis of number
of parameters. (default param alike probably)

More information about the fpc-pascal mailing list