Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2015-06

Object file requiring kernel32.dll functions

2 messages · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

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

Reply by email

patspiper
to patspiper
patspiper wrote 26 lines
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

Reply by email