Author Topic: Building a simple MessageBox  (Read 16748 times)

mark allyn

  • Guest
Building a simple MessageBox
« on: August 08, 2009, 02:55:09 AM »
Hello everyone -

I am trying to write a very simple NASM pgm that shows a windows messagebox.  My NASM code assembles fine to an mbox.obj with Win32 format.  Where i fail is in the link step.  I have tried Alink as well as GCC to do the linking.  With either I get a message saying that _MessageBoxA isan unresolved external.  If I strike the underscore in front of MessageBox, I still get the same reply.  I have defined MessageBoxA as an external in the code segment.

I apparently am missing some WinAPI's.  Or something.  Any ideas?

Thanks,
Mark Allyn

nobody

  • Guest
Re: Building a simple MessageBox
« Reply #1 on: August 08, 2009, 08:14:24 PM »
It could be that 'win32.lib' is old/buggy/incomplete.  If you are really serious about experimenting with the win32 API functions without incurring additional headaches, I recommend one of these paths:

Go Tools:
http://www.jorgon.freeserve.co.uk/

HLA:
http://webster.cs.ucr.edu/AsmTools/HLA/index.html

RosAsm:
http://betov.free.fr/

MASM32:
http://www.movsd.com/

Nathan.

mark allyn

  • Guest
Re: Building a simple MessageBox
« Reply #2 on: August 08, 2009, 09:08:48 PM »
Hi Nathan -

Thanks for the advice.  There are so many reasons to stick with NASM and MinGW that I really don't want to try yet another assembler.  I already do some stuff with MASM and using it gives me good access to Win32 api's.  But, MASM syntax is a bit difficult compared to NASM (I find) so I'd prefer to work off MinGW and NASM.  MinGW gives me the gcc compilers and they are really nice for straight c/c++.  All I want to do is be able to do in NASM what I can do in MASM.

Should be possible!!!  would you mind if I sent you my little messagebox plus the command lines?  Maybe I'm missing something simple...

Mark Allyn

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: Building a simple MessageBox
« Reply #3 on: August 08, 2009, 10:19:14 PM »
Please do post the command line(s) you're using. I, at one time, had some success with "%define MessageBox _MessageBoxA@16" (four parameters to MessageBox, right? Make it "@20" if there are five). You could, of course, use "_MessageBoxA@16" throughout. Unless I'm mistaken, this is something those "includes" would take care of. More later...

Best,
Frank