Question

Comrades, I'm quite a newbie to assembly programming, and I'm starting with masm32 assembler and later nasm assembler. So I've created a first assembly source file and I've tried assembling and linking it with the masm32 editor. And I keep getting a link error:

warning LNK4003 : invalid library format; library ignored
hello.obj : error LNK2001 : unresolved external symbol _DumpRegs @0
hello.exe : fatal error LNK1120 : 1 unresolved externals
_
Link error

The source file is hello.asm and its contents are:

.386
.model flat,stdcall
.stack 4096

includelib C:\masm32\include\Irvine32.inc

DumpRegs PROTO


.data

var1 WORD 120
var2 WORD 99

.code
start:


call DumpRegs


end start

PUBLIC start

end

I was attempting to output the contents of the registers for a start and I got stuck. I'm running on win7 Ultimate x64 operating system. How I'm supposed to compile it or if, in any case there's a problem with the source code, what i'm I supposed to change? Any help is gratefully appreciated

Était-ce utile?

La solution

I figured that different assemblers come with different linkers, even they all support the very same masm syntax. I'm not sure if the Irvine libraries require a little tweaking for each of these because none of them came with the Irvine libraries. But since most if not all masm assemblers work only on windows platforms, I used the Visual C++ to assemble my masm programs. I got the Irvine libraries plus a visual studio project file to ease my setting up procedures from this web page. The website contains all info that you need about setting up your project just before you start the programming itself. The beauty of visual studio is that, all you need to do is just

include Irvine32.inc

or

include Irvine16.inc

etc, then write your source code. You don't need to think about the Irvine32.lib or Irvine16.lib. Then you just click on run or start without debugging button and you're good to go. This saves you a lot of work and it doesn't take long to set up.
Cheers!

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top