The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => 16 bit DOS Programming => Topic started by: black_flowers on January 22, 2011, 01:01:01 PM

Title: how to specify otuput file when compiling with ml.
Post by: black_flowers on January 22, 2011, 01:01:01 PM
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
Title: Re: how to specify otuput file when compiling with ml.
Post by: 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
Title: Re: how to specify otuput file when compiling with ml.
Post by: black_flowers on January 22, 2011, 01:31:43 PM
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.
Title: Re: how to specify otuput file when compiling with ml.
Post by: 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.
Title: Re: how to specify otuput file when compiling with ml.
Post by: black_flowers on January 22, 2011, 02:38:07 PM
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?
Title: Re: how to specify otuput file when compiling with ml.
Post by: MichaelW on January 23, 2011, 12:05:45 AM
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.
Title: Re: how to specify otuput file when compiling with ml.
Post by: KeepingRealBusy on January 23, 2011, 01:56:16 AM
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).
Title: Re: how to specify otuput file when compiling with ml.
Post by: jj2007 on January 23, 2011, 06:52:55 AM
Quote from: KeepingRealBusy on January 23, 2011, 01:56:16 AM
Dave. (different Dave).

error A2008:syntax error : .

Use .OPTION DOTNAME, Dave!