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

Marc Santhoff M.Santhoff at web.de
Thu Jan 31 21:57:57 CET 2019


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
>
>
> sorry for complaining about windows, but i feel like this is more difficult
> on windows.
> All of the FPC examples, seem to run without this extra '_' business and i
> suspect they are on linux Os macOs.

You could rename your "HelloC.o to "_HelloC.o" before archiving inte the
library? Not that beautiful, but would be working, wouldn't it?

@Sven:
Maybe it is a later addition,  but her on fpc 2.6.4 your syntax is not
mentioned in the Programmers Guide (prog.pdf).

If i did look carefully enough there is no description of the syntax for:

"external name <NAME>"

And more, those details of naming and the different name conventions on Win32
and Win64 are missing, too. I think there should be at least a wiki page or
better some explanations in the Programmers Guide.

--
Marc Santhoff <M.Santhoff at web.de>



More information about the fpc-pascal mailing list