Author Topic: Bug in win32 format  (Read 10234 times)

Offline ben321

  • Full Member
  • **
  • Posts: 185
Bug in win32 format
« on: December 06, 2017, 10:55:20 PM »
When using "-f win32" it doesn't recognize the IMPORT statement for importing a DLL function. The following code, for example, does not compile when using "-f win32" or "-f coff", and instead gives the error "error: parser: instruction expected".
Code: [Select]
IMPORT MessageBoxA user32.dll
EXTERN MessageBoxA

GLOBAL start

section .data USE32
Text: db "This is a test.",0

section .text USE32
start:
push 0
push 0
push Text
push 0
call [MessageBoxA]
ret


But it does compile when using "-f obj". But that introduces its own problem. It's an older standard of object file known as OMF. All proper 32bit Windows compilers use COFF standard (which is what is used with "-f win32" or "-f coff"). While alink.exe will work with OMF type object files, not all linkers will (such as the other popular freeware linker known as GoLink). NASM developers, please fix this bug, and support the IMPORT statement with "-f win32".