[fpc-devel]Library linking with C explanation
Michael Van Canneyt
michael.vancanneyt at wisa.be
Wed Jun 20 09:17:10 CEST 2001
On Wed, 20 Jun 2001, Sergey Korshunoff wrote:
> >> >> Reply-To: core at freepascal.org
> >> >> Date: Sun, 3 Jun 2001 15:12:42 +0200 (CEST)
> >> >> From: Peter Vreman <pfv at cooldown.demon.nl>
> >> >> X-Sender: pfv at dell
> >> >> To: core at freepascal.org
> >> >> Subject: Library linking with C working !
> >> >>
> >> >>
> >> >> It was more easy than i first thought. No need for .ctor and
> >> >> .dtor stuff. Just pass "-init <Symbolname>" to the linker and the
> >> >> symbol to run at load of the library is set. The same for -fini.
> >> >>
> >> >> The 1.0.5 compiler works correctly.
> >> Congratulation!
> >> We speak about last variant of 1.0.5 -- that is right?
> >> FPC 1.0.5 from 14 march 2001 do not works correctly.
> As I see from compiler source LOG, changes are made at 6 june 2001.
> And "-init SYMBOL" key is quite new for ld. My old ld do not have it.
> It upgraded to GNU ld 2.10.90 (Copyright 2000 Free Software Foundation).
> I use glibc v2.1.1. Result:
> In my configuration 1.0.5 _do not_ work correctly.
> There is problem with argc, argv, envp.
> Are You shure, that INIT function for *.so can get this args?
> I look sources from ld-linux.so. As I understand, this args are
> send to global constructors and not to *.so INIT function.
> I examine DCC behavior.
> There is no ParamCount and ParamStr avaible for library functions
> ( ParamCount result in DCC compiled example is 0).
> And GetEnvironmentVariable() in DCC use function from libc
The support for libraries in Linux is quite new, and hasn't been
tested extensively yet, this still needs to be done.
We'll see what we can do to solve these problems.
More information about the fpc-devel