[fpc-pascal] trying to use C code in .pas on WIN32

Tomas Hajny XHajT03 at hajny.biz
Thu Jan 31 22:42:44 CET 2019

On Thu, January 31, 2019 21:57, Marc Santhoff wrote:
> On Thu, 2019-01-31 at 11:00 -0700, conlin664 via fpc-pascal wrote:
>> sven,
>> so I just tried, what I think you said:
>> procedure HelloC; cdecl; external name 'HelloC';
>> pcode.pas(19,1) Error: Undefined symbol: _HelloC
> You could rename your "HelloC.o to "_HelloC.o" before archiving inte the
> library? Not that beautiful, but would be working, wouldn't it?

@Marc: No, because 'HelloC' is name of the procedure, not of the object file.

@John: I noticed that you use a very old FPC version (2.4.4?) Do you get
the same problem with the latest release?

Moreover - wouldn't 'stdcall' be more appropriate than 'cdecl' in your
case? What does 'objdump -t ccode.o' show about HelloC?


More information about the fpc-pascal mailing list