I'm a returning ASM programmer from the 6809E & later 8088 days. Lots to relearn!
I'm hitting numerous errors trying to link a hello world example from Tutorial Point
Particulars: I'm on Windows 10. Vidual Studio 2015 installed. MinGw V2013072300 installed. Nasm V2.12 64 bit
So I used a copy of the standard Hello world samples circulating. Here's one of them;
section .text
global _main ;must be declared for using gcc
_main: ;tell linker entry point
mov edx, len ;message length
mov ecx, msg ;message to write
mov ebx, 1 ;file descriptor (stdout)
mov eax, 4 ;system call number (sys_write)
int 0x80 ;call kernel
mov eax, 1 ;system call number (sys_exit)
int 0x80 ;call kernel
section .data
msg db 'Hello, world!',0xa ;our dear string
len equ $ - msg ;length of our dear string
I'm compiling it with;
nasm -f win32 helloworld.asm
I've tried linking it with;
ld -m elf_i386 -s -o helloworld helloworld.o (from the tutorial site - fails to find the emulation elf_i386)
link /subsystem:console /nodefaultlib /entry:main Helloworld.obj kernel32.lib (fails to find the Kernal32.lib - I did HD searches for kernel*.*.. nthin found)
I tried one of the HelloWorld samples from the forums here which had the GetStdHandle, WriteFile & ExitProcess in it. The compile and link suggestions where;
nasm -f win32 myprog.asm
ld -o myprog.exe myprog.obj
Failed with undefined reference errors to the symbols. I suspect it wants the library but with kernal32.lib missing and this being Windows 10, I'm not sure what variations windows 10 throws into things.
Any help to get past my linking problems would be appreciated.
Thanks