[fpc-pascal] Error linking with C code

Xiangrong Fang xrfang at gmail.com
Wed Sep 18 11:29:38 CEST 2013


Hi All,

I am writing pascal wrapper for a C library called "CTP", which is used in
future trading.  My project is here:

https://github.com/xrfang/CTPas

Compiling the interface file along is successful. While linking, fpc
complains:

./thostmduserapi.so, needed by ./libthost.so, not found (try using -rpath
or -rpath-link)

while libthost.so is my wrapper writting in C, which uses
thostmduserapi.so, provided by the vendor (no source code).

Full error output is:

Free Pascal Compiler version 2.6.2 [2013/03/17] for x86_64
Copyright (c) 1993-2012 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling demo.pas
Linking demo
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
/usr/bin/ld: warning: ./thostmduserapi.so, needed by ./libthost.so, not
found (try using -rpath or -rpath-link)
./libthost.so: undefined reference to
`CThostFtdcMdApi::CreateFtdcMdApi(char const*, bool, bool)'
demo.pas(4,1) Error: Error while linking
demo.pas(4,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode (normal if you did not
specify a source file to be compiled)

Could you please explain how to solve this problem?

Thanks!
Xiangrong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130918/a6e5eb3a/attachment.html>


More information about the fpc-pascal mailing list