Hi guys, I am starting to learn assembly (from C++) so that I can code in a low level language. I am having a problem, I downloaded, setup, and installed mASM. I then added it to my environmental settings, and downloaded LNK563.exe. However, I am having trouble compiling. I get this error:
1st.obj : fatal error L1101: invalid object module
Object file offset: 1 Record type: 4c
After hours of researching, I discovered that this error was due to miss-matching versions between my linker and compiler. So, I discovered that my compiler (mASM) is version 6.14.8444 and that my linker is version 5.60.339. I have tried to find LNK563 v 5.60.339 for 2 hours now, but I have had no luck. So, I have 2 questions.
1. Am I correct? Is this error occurring because of version mismatches? or is it something else?
2. If I am correct, what should I do? Does anybody know were I could download different versions of either my linker or compiler? Or is there another solution?
Thanks, David.
you're not looking for a matching version between linker and assembler but that's as far as I can help you
If you are building 32-bit programs then don't use lnk563.exe as that version of link is the 16-bit linker.
If you are building 16-bit programs then use the '/omf' switch with ml.exe
the versions you have should work
perhaps you could post some code so we can see what kind of source you have (command line, GUI, 16-bit, etc)
and - show us the command lines you are using to assemble and link
.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib
.data
MsgBoxCaption db "Iczelion Tutorial No.2",0
MsgBoxText db "Win32 Assembly is Great!",0
.code
start:
invoke MessageBox, NULL, addr MsgBoxText, addr MsgBoxCaption, MB_OK
invoke ExitProcess, NULL
end start
To assemble: ml /c /coff /Cp 1st.asm
to link:
link 1st.obj
Run file: 1st.exe
<rest is default>
Link /SUBSYSTEM:WINDOWS /OPT:NOREF 1st.obj
also, you can replace the following:
.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib
with:
include \masm32\include\masm32rt.inc
that file has all the stuff you usually need
That's nice to know. Ty, will save me some typing.
This is what happens when I link like that:
LINK : warning L4017: /SUBSYSTEM : unrecognized option name; option ignored
LINK : warning L4017: /OPT : unrecognized option name; option ignored
Run File [1st.exe]:
List File [nul.map]:
Libraries [.lib]:
Definitions File [nul.def]:
1st.obj : fatal error L1101: invalid object module
Object file offset: 1 Record type: 4c
Sorry for double post, but I can't edit my first one. When I type link /help, here is what it tells me the valid commands are:
Valid options are:
/? /ALIGNMENT
/BATCH /CODEVIEW
/CPARMAXALLOC /DOSSEG
/DSALLOCATE /DYNAMIC
/EXEPACK /FARCALLTRANSLATION
/HELP /HIGH
/INFORMATION /LINENUMBERS
/MAP /NODEFAULTLIBRARYSEARCH
/NOEXTDICTIONARY /NOFARCALLTRANSLATION
/NOGROUPASSOCIATION /NOIGNORECASE
/NOLOGO /NONULLSDOSSEG
/NOPACKCODE /NOPACKFUNCTIONS
/NOFREEMEM /OLDOVERLAY
/ONERROR /OVERLAYINTERRUPT
/PACKCODE /PACKDATA
/PACKFUNCTIONS /PAUSE
/PCODE /PMTYPE
/QUICKLIBRARY /SEGMENTS
/STACK /TINY
/WARNFIXUP
Use the link.exe that came with masm32 and forget lnk563.exe because it is a 16-bit linker and knows nothing about PE files.
that is the output from link16.exe
check your masm32\bin folder - there should be link.exe and link16.exe
also - check your PATH environment variable
the path that appears first in that variable that has a link.exe is the one that gets executed
the output from the linker with no command line parameters should look like this...
C:\masm32\bin>link
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
usage: LINK [options] [files] [@commandfile]
options:
/ALIGN:#
/BASE:{address|@filename,key}
/COMMENT:comment
/DEBUG
/DEBUGTYPE:{CV|COFF}
/DEF:filename
/DEFAULTLIB:library
/DLL
/DRIVER[:{UPONLY|WDM}]
/ENTRY:symbol
/EXETYPE:DYNAMIC
/EXPORT:symbol
/FIXED[:NO]
/FORCE[:{MULTIPLE|UNRESOLVED}]
/GPSIZE:#
/HEAP:reserve[,commit]
/IMPLIB:filename
/INCLUDE:symbol
/INCREMENTAL:{YES|NO}
/LARGEADDRESSAWARE[:NO]
/LIBPATH:dir
/MACHINE:{ALPHA|ARM|IX86|MIPS|MIPS16|MIPSR41XX|PPC|SH3|SH4}
/MAP[:filename]
/MAPINFO:{EXPORTS|FIXUPS|LINES}
/MERGE:from=to
/NODEFAULTLIB[:library]
/NOENTRY
/NOLOGO
/OPT:{ICF[,iterations]|NOICF|NOREF|NOWIN98|REF|WIN98}
/ORDER:@filename
/OUT:filename
/PDB:{filename|NONE}
/PDBTYPE:{CON[SOLIDATE]|SEPT[YPES]}
/PROFILE
/RELEASE
/SECTION:name,[E][R][W][D][K][L][P][X]
/STACK:reserve[,commit]
/STUB:filename
/SUBSYSTEM:{NATIVE|WINDOWS|CONSOLE|WINDOWSCE|POSIX}[,#[.##]]
/SWAPRUN:{CD|NET}
/VERBOSE[:LIB]
/VERSION:#[.#]
/VXD
/WARN[:warninglevel]
/WINDOWSCE:{CONVERT|EMULATION}
/WS:AGGRESSIVE
Thank you very much dedndave and sinsi, I reinstalled masm32 and the linker is working perfectly.
Oh and I have one last question, are there any good online resources for mASM? For C++ I would just check up on MSDN. Is there a "MSDN" for mASM?
we use the same MSDN - often, too - lol
we just have to translate the specs from VOID to INVOKE
at first, it is a little confusing
after you have written a few programs, it gets easier