[fpc-pascal] FPC linker oddity

patspiper patspiper at gmail.com
Sun Jun 21 22:20:08 CEST 2015

On 21/06/15 23:08, Jonas Maebe wrote:
> On 21/06/15 21:43, patspiper wrote:
>> program Project1;
>> {$Linklib kernel32}
>>    Function GetTickCount: DWORD; external;
>> begin
>>    WriteLn ('GetTickCount ', GetTickCount);
>> end.
>> project1.lpr(10,1) Error: Undefined symbol:
>> Changing the GetTickCount declaration to any of the following works:
>>    Function GetTickCount: DWORD; external name
>> '_$dll$kernel32$GetTickCount';
>>    Function GetTickCount: DWORD; external 'kernel32';
>> Why is the behaviour different between Linux and Windows?
> ELF (used by Linux) and PECOFF (used by Windows) use completely
> different ways of shared linking.
So what should be done to remedy the Windows case when $LINKLIB is used, 
that is unless $LINKLIB is not to be used with Windows?

Note that in the 2 'solutions' I gave, $LINKLIB is not needed and can be 
removed altogether.


More information about the fpc-pascal mailing list