[fpc-pascal] Mangle name in fpc-FreeBSD ?

fredvs fiens at hotmail.com
Sun Mar 20 23:24:21 CET 2016

>> Why do you use "hn: Intege"hn: Integer" instead of "hn: TLibHandle"
> Excellent question...
> Because of... fpc...
> In fpc 64 bit unix : result of dynlibs.loadlibrary() is... a integer. 


How will I explain that ?...

In the pascal header of the library that gives problems this is defined :
var libhandle : {$IFDEF MSWINDOWS}longword{$ELSE}{$IFDEF

And in all the other library-headers that i use without problems it is
defined like this:
var libhandle:TLibHandle=dynlibs.NilHandle; 

Maybe (surely) the first definition is wrong.

I have to re-test the problematic library with
var libhandle:TLibHandle=dynlibs.NilHandle; 

and see if it is ok for GetProcAdress().

Maybe that was the problem.

Write you later.

PS: Sorry for all the noise but it is not easy.
FreeBSD, in his pkg install a_library gives only the main dynamic library
All dependent-libraries are static (*.a).
So the end user has to re-compile all .a libraries to make it dynamic.

For the library in question: -> libmp4ff.a -->
gcc -shared -o libmp4ff.so.0.0.0 -Wl,--whole-archive libmp4ff.a

Then you have a dynamic library.

Huh, not so easy because there is the C war...
So you have to make:
gcc -shared -o libmp4ff.so.0.0.0 -Wl,--whole-archive libmp4ff.a
CC -shared -o libmp4ff.so.0.0.0 -Wl,--whole-archive libmp4ff.a
clang -shared -o libmp4ff.so.0.0.0 -Wl,--whole-archive libmp4ff.a
cpp -shared -o libmp4ff.so.0.0.0 -Wl,--whole-archive libmp4ff.a

And test each result with nm libmp4ff.so.0.0.0.
Finally, cpp gives something "doable".

And the problem was to know if that compiled library was ok.

Now, thanks to your help, I am sure the library is ok.

I feel bad to not have seen that the (surely) wrong declaration of
library_handle was maybe the cause of all the problems.


Many thanks ;-)
View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Mangle-name-in-fpc-FreeBSD-tp5724528p5724605.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.

More information about the fpc-pascal mailing list