Object file requiring kernel32.dll functions

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Object file requiring kernel32.dll functions

patspiper
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.

Stephano
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Object file requiring kernel32.dll functions

patspiper
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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal