[fpc-pascal] Error linking with C code

Michael Van Canneyt michael at freepascal.org
Wed Sep 18 11:36:17 CEST 2013



On Wed, 18 Sep 2013, Xiangrong Fang wrote:

> 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).

where is thostmduserapi.so ?

Michael.
> 
> 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
> 
>


More information about the fpc-pascal mailing list