[fpc-pascal] Object file requiring kernel32.dll functions
patspiper
patspiper at gmail.com
Sun Jun 21 18:38:50 CEST 2015
On 21/06/15 18:09, patspiper wrote:
> The situation is as follows:
>
> - Platform: Windows
>
> - file1.obj: 3rd omf object file (no source available) that can be
> used by Delphi linker and calls kernel32.dll functions such as
> GetTickCount and GetLastError.
>
> - file1.coff: file1.obj converted to coff format using objconv.exe
> (http://www.agner.org/optimize) with the exported names adjusted to be
> used by fpc.
>
> - fpc is passed on the following options:
> -k-L/usr/i586-mingw32msvc/lib -k-lkernel32
>
> - Compiling (via Lazarus) outputs several errors like:
> project1.lpr(20,1) Error: Undefined symbol: GetVersion
>
> How come Delphi can produce a working executable and fpc can't?
>
> Could it be that something is getting lost in the omf/coff conversion?
>
> Can something else be done?
>
> It isn't possible to declare the kernel32.dll functions as external as
> it is file1.obj that requires them.
I solved this finally. While converting from omf to coff, conversion of
the called functions should be done as well.
Example:
GetLastError -> _$dll$kernel32$GetLastError
Stephano
More information about the fpc-pascal
mailing list