Win32_7 - Usage of OPTION DLLIMPORT and -Fd Switch

Asmc Macro Assembler

Win32_7 - Usage of OPTION DLLIMPORT and -Fd Switch


;--- Win32_7 - Shows how to use OPTION DLLIMPORT and switch -Fd.
;---           No import libraries are needed in the link step.
;---
;--- assemble: JWasm -coff -Fd Win32_7.ASM
;--- link:     JWlink format windows pe f Win32_7.OBJ

    .386
    .model FLAT, stdcall
    option casemap:none

STD_OUTPUT_HANDLE equ -11

   option dllimport:<kernel32>
WriteConsoleA proto :dword, :dword, :dword, :dword, :dword
GetStdHandle  proto :dword
ExitProcess   proto :dword
   option dllimport:<user32>
MessageBoxA   proto :dword, :dword, :dword, :dword
   option dllimport:<none>

    .const

msg db 13,10,"hello, world.",13,10
    db 0

    .code

main proc

local   written:dword

    invoke  GetStdHandle, STD_OUTPUT_HANDLE
    mov ebx, eax
    invoke  WriteConsoleA, ebx, addr msg, sizeof msg,
                addr written, 0
    invoke  MessageBoxA, 0, addr msg, 0, 0
    ret

main endp

;--- entry

start:

    invoke  main
    invoke  ExitProcess, 0

    end start