[fpc-pascal] Statically link library

Darius Blaszyk dhkblaszyk at zeelandnet.nl
Sun Apr 21 17:20:35 CEST 2013


<retrying with a smaller zip>

I have prepared a minimal example of
the linking problems I get. Just unzip, create a "build" dir and run
cmake. I'm using gcc 4.6.2.

As soon as I try to use the function
"file_size" I get the following linker errors:

Free Pascal Compiler
version 2.6.2 [2013/03/17] for i386
Copyright (c) 1993-2012 by Florian
Klaempfl and others
Target OS: Win32 for i386
Compiling test_h.pas
Linking project1.exe
test.pp(9,1) Error:
Undefined symbol: _open
test.pp(9,1) Error: Undefined symbol:
test.pp(9,1) Error: Undefined symbol: _close
Fatal: There were 3 errors compiling module, stopping

It really seems I
need to add an additional library to the pascal source or that the
linker cannot find some included symbols in libmsvcrt.a.

Any help

Regards, Darius

Ludo Brands schreef op 20 apr '13: 

> On
04/20/2013 11:54 AM, Darius Blaszyk wrote:
>> Hi, I'm linking a C and
FPC program but I keep on getting undifined symbols (see example below).
Error: Undefined symbol: _strcpy Sofar I have added: {$linklib msvcrt}
{$linklib gcc} What other libraries should I add? BTW, I'm compiling the
C library with MinGW. Regards, Darius
> _strcpy should be in msvcrt.
It is defined in the mingw libmsvcrt.a file
> on my system. Is your lib
path correct?
> BTW I use an explicit {$linklib libmsvcrt.a} with
> Ludo
> _______________________________________________
fpc-pascal maillist - fpc-pascal at lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal [1]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130421/d7440ad3/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fpc_C.zip
Type: application/zip
Size: 2396 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130421/d7440ad3/attachment.zip>

More information about the fpc-pascal mailing list