[fpc-pascal] linking and using dynamic libraries on amd64

Marc Santhoff M.Santhoff at web.de
Thu Feb 12 00:42:59 CET 2015


Hi,

when I try to run a program that dynamically links an external .so
library it throws a SIGSEGV error at startup. That seems to happen while
loading the library before any code of mine is exeuted.

The library is pulled into it by a header translation from C to Pascal.
The functions are declared "...; stdcall; external libname name xxx'.
This way it worked on i386.

When the error occurs the ASM window pops up, which is not very helpful
for me.

There may be a minor change in the lib source itself, but compiling the
header and linking works OK. I have no idea how to check besides getting
the older versions source and try again. Will try if nothing else is
fishy.

My questions:

Is there any difference in declaring external functions between 32 and
64 bit mode?

How can I debug what is happening? Will compiling the library having an
external debug file work when debugging from Lazarus?

Any hints for diagnosing what's going wrong are very welcome.



Some data points:
fpc 2.6.2 x86_64
library is compiled to 64 bit
FreeBSD 9.1-STABLE amd64

Best regards,
Marc 

-- 
Marc Santhoff <M.Santhoff at web.de>




More information about the fpc-pascal mailing list