Author Topic: Additional resources for Win32 nasm?  (Read 6488 times)

nobody

  • Guest
Additional resources for Win32 nasm?
« on: July 17, 2008, 12:54:15 AM »
I realize that the NASM download is just the binary executable assembler and disassembler, but where do I find additional resources such as C libraries and include files?  I just don't understand how to generate standalone, statically-linked programs with NASM.  For example:

---------------------------------------
extern _printf

segment .data
num dd 43
fmt db 'num = %d', 10, 0

segment .code
start:  push num
        push fmt
        call _printf
        add esp, 8
        ret
---------------------------------------

What do I link with to use _printf?  Where do I find it?  I have MS Visual C++ 2008 installed, so I tried linking with its C static-link library (libcmt.lib), but that didn't work.  I was able to find a WIN32N.INC and win32.lib from somewhere, and have been able to create message boxes using those, but unfortunately that didn't help me understand much... I'm not even sure exactly what question to ask, and I think it's because I'm so lost.  Help?

Thanks!

nobody

  • Guest
Re: Additional resources for Win32 nasm?
« Reply #1 on: July 17, 2008, 07:32:41 PM »
You can find the most current include file for Windows here:

http://www.asmcommunity.net/projects/nasmx/

I don't "do Windows". In Linux, a statically linked program using printf runs about 400000 bytes (ouch!!!). You probably want dynamic linking - probably against "msvcrt.dll"(???). See if the examples in "Nasmx" will give you a clue...

Best,
Frank