On Wed, 2019-01-23 at 14:30 -0700, conlin664 via fpc-pascal wrote:
> 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.
>

Try stdcall on Win32:

  procedure CutilInit;  stdcall; external 'common' name 'CutilInit';

If the full external declaration is necessary you'll have to try. I had to
when using a dynamic library (.dll in win32 terms).

--
Marc Santhoff <m.santh...@web.de>
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to