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

Marc Santhoff M.Santhoff at web.de
Thu Feb 14 03:55:39 CET 2019


On Tue, 2019-02-05 at 15:49 +0100, Marc Santhoff wrote:
> On Mon, 2019-02-04 at 15:59 -0700, conlin664 via fpc-pascal wrote:
> > THANKS GUYS.
> >
> > This is now working. The 'fix' was to actually install fpc 3.0.4 on this
> > machine.
> > My trusty 2.4.4 still compiled just fine what I use it for here at my day
> > job.
> >
> > But it seems 2.4.4 was not really pulling in the static reference.
> > { $L ccode.o }
>
> [...]
> > procedure HelloC; cdecl; external name 'HelloC';
> >
>
> [...]
>
> > compiled on WIN32 with:
> >
> > @set ToolPath=C:\VCAST63\MinGW\bin
> > @set cc=%ToolPath%\gcc.exe
> >
> > @set SAVED_PATH=%PATH%
> > @set PATH=%ToolPath%;%PATH%
> >
> > @set BASE=%cd%
> >
> > %CC% -g -I%BASE%  -DGNU_WIN32 -O1  -Wunused-variable   -c ccode.c -o
> > ccode.o
> >
> > rem %cc% -o test.exe ccode.o pcode.o  -lwsock32
> >
> > fpc -MDelphi  -vw -Sg  -Ci -O1  -OpPENTIUM3 -Ratt ^
> > -Fu%FPC_BASE%\units\i386-Win32 ^
> > -Fu%FPC_BASE%\units\i386-Win32\* ^
> > -Fu%FPC_BASE%\units\i386-Win32\rtl ^
> > -FlC:\VCAST63\MinGW\lib ^
> > pcode.pas
> >
> > @set PATH=%SAVED_PATH%
> > @exit /b
>
> Why does this work having 'cdecl' instead of 'stdcall'?
>
> Is it a special case regarding mingW32 that would not have happened using a
> native compiler like the one from Microsoft or Borland or similar?

http://willus.com/mingw/yongweiwu_stdcall.html

I will not write anything about that mess, feeling sick already.

--
This computer is not running MICROS~1.



More information about the fpc-pascal mailing list