On Do, 2015-02-12 at 09:03 +0000, Tony Whyman wrote: > Marc, > > If your running on a *nix system then you probably want "cdecl" rather > than "stdcall"
Err ... you're right and it is cdecl. I have mixed it up because it is an $if_n_def ...: ...;{$ifndef Win32}cdecl{$else}stdcall{$endif};external libname name 'xxx'; If I find the time I'll go on and investigate the exact position the error occurs. Maybe it is possible to build it with debugging symbols, in code I have to find a way throug the macro djungle ... one reason to use Object Pascal. Thanks for waking me up. ;) Marc > On 12/02/15 04:54, Marc Santhoff wrote: > > On Do, 2015-02-12 at 00:42 +0100, Marc Santhoff wrote: > >> 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. > > I did test the old library and the error is the same. > > > > GDB tells me it happens when starting at BEGIN and running the init function > > of the library. That function does not have any arguments, I'm assuming > > "something else" then ... > > > >> 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 > >> > > _______________________________________________ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal -- Marc Santhoff <m.santh...@web.de> _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal