[fpc-pascal] bridging an C++ shared library statically
Xiangrong Fang
xrfang at gmail.com
Sat Sep 21 16:24:19 CEST 2013
Ok, but when I added these:
implementation
{$linklib libthostintf.a}
{$linklib thostmduserapi.so}
end.
I got:
/usr/bin/ld: cannot find -lthostmduserapi
All the required .so and .a file are in CURRENT dir.
2013/9/21 Michael Van Canneyt <michael at freepascal.org>
>
>
> On Sat, 21 Sep 2013, Xiangrong Fang wrote:
>
> Hi All,
>>
>> I need to use a C++ so file in FreePascal. I have written a C wrapper
>> for it, which successfully connected to Pascal.
>>
>> Now my question is, can I use the $linklib directive to link the
>> C-Wrapper STATICALLY, which in-turn use the shared so file? I tried to do
>> this but it complained a lot of
>> undefined references.
>>
>
> This is normal.
>
>
>
>> The key problem is, the {$linklib} instruction only tell FPC where to
>> look for external functions in the C Wrapper, but how can I tell the linker
>> to look for the ORIGINAL C++
>> so file to look for symbols required but not defined in the C-Wrapper?
>>
>
> {$linklib XYZ}
>
> can be used for any library. So you should add the C wrapper library, C++
> library,
> and probably some others as well, such as the C++ STL.
>
> Michael.
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130921/f9185b4b/attachment.html>
More information about the fpc-pascal
mailing list