I've done research, but am just missing something. my .pas code links just fine, but doesn't RUN. ( first writeln never appears ) If I remove the external call to C code, then the writeln works as normal.
Problem: I have c code, which I'm compiling on a WIN32 machine ( yes the horror ) using GCC 4.5.2 target mingw32 It generates .o files which i grouped together with ar into common.a I then renamed common.a to be libcommon.a Then I have a Common.pas file: unit Common; interface uses sysutils, dos, CTypes; {$linklib libcommon.a } procedure CutilInit; cdecl; external 'CutilInit'; implementation end. the a CommonTest.pp file: Program commonTest; uses Common; begin writeln('got here'); CutilInit(); end. fpc.exe -TWin32 -Mdelphi -vw -Sg -Ci -O1 -Cp386 -XS -gl -p- -b- is the relevant way I'm invoking fpc It links, but then does nothing on execution. If I change the C line to be: procedure CutilInit; cdecl; external; I think get a link error Undefined Symbol: _CutilInit Any ideas ? Does the linklib define need to be below where I declare the C routines ? Is it something to do with WINDOWS.. ( aka the _ in the name ) Maybe I need different options on the C compile.. -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal