When I execute a small program which links to a dynamic library, ld complains:
./TestExe
hello 42
Inconsistency detected by ld.so: dl-fini.c: 195: _dl_fini: Assertion `ns != 0 || i == nloaded' failed!
This is on Debian Lenny (Free Pascal Compiler version 2.2.2 [2008/07/30] for i386
, GNU ld (GNU Binutils for Debian) 2.18.0.20080103). On my Mac the code works.
I do not have much experience with fpc (on linux) and dynamic libraries and wanted to ask if there is something obvious which I do wrong. And/or what next steps I should/could do?
(in google I found a similar problem
()
but it doesn't help me).
The code is below. Thanks for tips and having a look!
Hans-Peter
--------- TestShlib.pas --
library TestShlib;
{$mode objfpc}{$H+}
uses
SysUtils;
function hello: integer; cdecl;
begin
result:= 42;
end;
exports hello;
begin
end.
--------- TestExe.pas --
program TestExe;
{$mode objfpc}{$H+}
uses
SysUtils;
function hello: integer; cdecl; external 'TestShlib';
begin
WriteLn( Format( 'hello %d', [hello()] ) );
end.--------- compile/link --
fpc -CD TestShlib.pas -o./TestShlib.so
fpc -k"-R ." -k-lTestShlib TestExe.pas
