程式語言 - FreeBASIC - Win32 API - Hello, world!



參考資訊:
https://www.freebasic.net/
https://sourceforge.net/projects/fbc/files/

main.bas

#include once "windows.bi"
 
declare function WinMain(byval hInst as HINSTANCE, _
    byval hPrevInst as HINSTANCE, _
    byval szCmdLine as zstring ptr, _
    byval dwCmdShow as integer) as integer
end WinMain(GetModuleHandle(null), null, Command(), SW_NORMAL)
 
function WinMain(byval hInst as HINSTANCE, _
    byval hPrevInst as HINSTANCE, _
    byval szCmdLine as zstring ptr, _
    byval dwCmdShow as integer) as integer
 
    MessageBox(null, "Hello, world!", "", MB_OK)
    return 0
end function

Makefile

TARGET = main

all:
	myx86 "c:\fbc\fbc32.exe" ${TARGET}.bas

run:
	myx86 ${TARGET}.exe

clean:
	rm -rf ${TARGET}.exe ${TARGET}.o

編譯、執行

$ make
$ make run

完成