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

Marc Santhoff M.Santhoff at web.de
Fri Feb 1 00:35:27 CET 2019


On Thu, 2019-01-31 at 22:42 +0100, Tomas Hajny wrote:
> 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.

You and Sven are right of course. I played around using nm, which the op
should probably do.


> @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?

<censored/>

That's what I asked for, then overlooked it...

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



More information about the fpc-pascal mailing list