[fpc-pascal] $LINKLIB MSVCRT on windows/osx

md at rpzdesign.com md at rpzdesign.com
Sun Mar 9 20:36:01 CET 2014


Marco:

Based on the tone of your response, I am thinking that I
am doing something stupid on windows win32?

Should I be using Microsoft compiler to build  ceecodelib.a? (Instead of 
Mingw 4.7x)

I was seeing COFF magic error for Microsoft compiler static libraries.

The amount of information I found on compiling c-code for static linking 
against freepascal has
been pretty sparse, so I guessed that I need to use a gcc compiler to 
create static linkable code for freepascal 2.6.2

A good example is inside the static library ceecodelib.a which calls: 
GetTickCount( )

My pascal code successfully links {$LINKLIB objwin32/libceecode.a}, but 
that is not the real problem.

This error shows up in the linker for freepascal as:

Error: Undefined symbol: _GetTickCount at 0

So that is what I am trying to get rid of, all the unresolved references 
by telling the linker where to find the function
without having to manually put a function GetTickCount : DWORD; cdecl ; 
external name 'Kernel32.dll' ; in a pas file for every unresolved reference.

Just easier with {$LINKLIB kernel32}, except the compiler spits out:

Error: Import library not found for kernel32.  (Yikes!)

Help me Obi-Wan Kenobi, your my only hope.

md








On 3/9/2014 2:52 PM, Marco van de Voort wrote:
> In our previous episode, md at rpzdesign.com said:
>> Thanks for your response.
>>
>> I am trying to use {$LINKLIB ceecodelib.a} .
>>
>> But this compiled c code makes references to Windows C Runtime calls
>> like _memcpy, etc.
> What is that library compiled with? I guess mingw.
>
> You probably need various .a files from that compiler to get this working.
> Preferably exactly the same version and exactly the same build, though
> I guess import libs are pretty invariant.
>
> The ones that you see in gdbint are meant to be used with a package that
> contains libgdb.a and all other .a's that are dependencies from the mingw
> suite these were built with.
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>




More information about the fpc-pascal mailing list