[fpc-pascal] bridging an C++ shared library statically
Xiangrong Fang
xrfang at gmail.com
Sun Sep 22 04:01:40 CEST 2013
>
>
> 1) Did you give the correct name ? 2) Is the current dir in the linker
> search path ? AFAIK the current dir is by default not in the linker search
> path.
>
I am sure the name is correct. No matter I supply the linker path (-Fl.)
or not, it does not work (i.e. ld reported cannot find -lthostmduserapi)
How ever, I managed to compile it by doing the following:
1) rename thostmduserapi.so to libthostmduserapi.so
2) add the following into implementation section:
{$linklib thostmduserapi.so}
{$linklib ThostMdIntf.a}
{$linklib stdc++}
{$linklib gcc_s}
{$linklib c}
3) Compile the project with LD_RUN_PATH=.
However, my last question is: How can I instruct FPC to look for
thostmduserapi.so, NOT libthostmduserapi.so, i.e. WITHOUT the lib prefix?
I checked the ld man page, it said to put a colon prefix, to tell ld not to
prepend "lib". I then did this:
{$linklib :thostmduserapi.so}
Unfortunately, ld still cannot find the library, however the error message
changed:
/usr/bin/ld: cannot find thostmduserapi
while using {$linklib thostmduserapi.so}, the error was:
/usr/bin/ld: cannot find -lthostmduserapi
How to let ld look for library WITHOUT lib prefix?
Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130922/dceaf7ed/attachment.html>
More information about the fpc-pascal
mailing list