On 24 May 2010, at 13:59, vt...@volny.cz wrote: > is it possible to link FPC compiled units to a C program on Linux? > I'm not able to figure it out. > FPC uses some strange way to name symbols and whatever I try, I always > end up with the linking errors. > I'm probably doing some trivial error, but I just can't find it. > > Simple function: > > function aplusb(a,b:longint):longint;cdecl; > > gets exported as something like: > > text.n_testunit_aplusb$longint$longint$$longint
Add "export;" at the end of the declaration, then it will also get an unmangled symbol name (but only because it's declared as cdecl). And please do not follow the other advice you got about manually adding an alias, because C name mangling differs from platform to platform and hence the name you'd specify would only work on some platforms. Jonas_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal