how to specify otuput file when compiling with ml.

Started by black_flowers, January 22, 2011, 01:01:01 PM

Previous topic - Next topic

black_flowers

hi there!, i'm newbie with masm, and with assembler in general, but i'm compiling an .asm program like this (with masm):
ml /c hola_mundo.asm
and linking it like this:
link16 hola_mundo
and my question is about how to specify the output file in both cases? I mean, that i need to put the .obj and the .exe file in an specific directory, how can i do that?

thank you! :bg

dedndave

normally, they will be in the current directory
for the linker, you can specify an output path\file using /OUT:path\file
not sure it can be done with ML - the question has never come up  :bg
we usually use batch files to handle assembly, in which case you could copy the files to whatever folder you like

for a list of options...
ML /?
LINK16 /?

welcome to the forum   :U

black_flowers

Quote from: dedndave on January 22, 2011, 01:11:39 PM
normally, they will be in the current directory
for the linker, you can specify an output path\file using /OUT:path\file
not sure it can be done with ML - the question has never come up  :bg
we usually use batch files to handle assembly, in which case you could copy the files to whatever folder you like

for a list of options...
ML /?
LINK16 /?

welcome to the forum   :U

it gives me warning, because it doesn't recognize the /OUT: option (actually it's not listed when type LINK16/?) and it ignores the /OUT option.

by the way... you have said that you not sure it can be done with Ml,so... what's the compiler you use? I thought that ml was the masm32 compiler.

MichaelW

LINK16 <objs>,<exefile>,<mapfile>,<libs>,<deffile>

You specify the output file in the exefile field, for example:

Link16 hola_mundo, c:\hola_mundo;

The output file will be hola_mundo.exe, and the semicolon tells the linker to use the defaults for any remaining fields.

If you specify the /TINY linker option, the linker defaults to creating a objectfilebasename.COM file, but unless you specify the full output file name it will issue a warning telling you that it created a .COM file.

If you specify the /MAP linker option, the linker defaults to creating a objectfilebasename.MAP file.
eschew obfuscation

black_flowers

Quote from: MichaelW on January 22, 2011, 02:03:44 PM
LINK16 <objs>,<exefile>,<mapfile>,<libs>,<deffile>

You specify the output file in the exefile field, for example:

Link16 hola_mundo, c:\hola_mundo;

The output file will be hola_mundo.exe, and the semicolon tells the linker to use the defaults for any remaining fields.

If you specify the /TINY linker option, the linker defaults to creating a objectfilebasename.COM file, but unless you specify the full output file name it will issue a warning telling you that it created a .COM file.

If you specify the /MAP linker option, the linker defaults to creating a objectfilebasename.MAP file.

great!! thanks. And can i do the same with ml, i mean: to secify the output path for the .obj file?

MichaelW

I'm assuming that you are assembling and linking from a batch file.

You should be able to specify a path for any of the files, including ML and Link16. You can also set environment variables in the batch file that will affect only the environment for the batch file. For example:

set file="test"
set path=c:\masm32\bin;%path%
if exist %file%.obj del %file%.obj
if exist %file%.exe del %file%.exe
ML /c /Fl /Sa %file%.asm
pause
Link16 /MAP %file%.obj;
pause


In addition to the EXE and OBJ files, the above creates an assembly listing file and a map file, all with the base name "test".

You can specify separate directories for each type of file, but doing so complicates the build process. I prefer to just place each project in its own directory, and keep everything for the project in that directory.
eschew obfuscation

KeepingRealBusy

I don't know which version you are using, but MASM 9.0 (VS2008) uses /fxFilename where x can be e,l,m,o for .exe, .lst, .map, .obj.

Dave. (different Dave).

jj2007