[fpc-pascal] Statically link library

Vittorio Giovara vittorio.giovara at gmail.com
Sun Apr 21 16:37:13 CEST 2013


On Sun, Apr 21, 2013 at 2:36 PM, Marco van de Voort <marcov at stack.nl> wrote:

> In our previous episode, Vittorio Giovara said:
> > > {$linklib gcc}
> > >
> > > What other libraries should I add? BTW, I'm compiling the C library
> with MinGW.
> >
> > You need to instruct fpc to use gcc instead of default ld when you
> > link c/pas code statically.
>
> Fpc can't call gcc.
>
> Well you could manually edit ppas.sh/link.res and substitute 'gcc' to
'ld', and of course adjust all the flags.


> > This is because gcc adds many linker flags that are automatically set
> > when you link something but are not set when you call ld directly.
>
> FPC can pass extra flags to the linker. Just harvest the flags by compiling
> a simple program with gcc
>
> Indeed, too bad sometimes you have to link gcc, sometimes gcc_s.1,
sometimes stdc++ and so on, depending on target, architecture, operating
system and so on...
Like I said other time, not really portable, but with little use-case too,
so not a big deal, right?

Cheers,
Vittorio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130421/c8750fb4/attachment.html>


More information about the fpc-pascal mailing list