The MASM Forum

General => The Workshop => Topic started by: dedndave on January 25, 2014, 10:02:50 PM

Title: Batch File - Building a Library
Post by: dedndave on January 25, 2014, 10:02:50 PM
i recently found an issue with MASM...

i created a response file with DIR/B, then assembled from the response file
dir/b *.asm>.\Resp.txt
ml /c /coff /nologo @Resp.txt >..\LibErr.txt

MASM is prone to errors - even crashed once

so, i wrote a FOR loop, instead
for %%f in (.\*.asm) do ml /c /coff /nologo %%f >>..\LibErr.txt
works every time   :P
Title: Re: Batch File - Building a Library
Post by: nidud on January 26, 2014, 12:56:38 AM
deleted
Title: Re: Batch File - Building a Library
Post by: dedndave on January 26, 2014, 02:49:41 AM
if that works, it's probably more-or-less the same as using a response file   :P
Title: Re: Batch File - Building a Library
Post by: nidud on January 26, 2014, 03:19:02 AM
deleted
Title: Re: Batch File - Building a Library
Post by: jj2007 on January 26, 2014, 04:10:03 AM
Long file names as such are probably OK, but missing quotes around filenames with spaces are a problem. Check the response file for spaces, try to put quotes around these, and see if ML still chokes.
Title: Re: Batch File - Building a Library
Post by: dedndave on January 26, 2014, 04:19:15 AM
the response file is not the problem
the problem seems to be that MASM doesn't fully "reset" between modules
by using a FOR loop, each module gets a fresh instance of MASM execution
Title: Re: Batch File - Building a Library
Post by: jj2007 on January 26, 2014, 04:26:07 AM
Strange. I always build MasmBasic using a response file, it never chokes with ML 6.15 .. 10 or JWasm.
Title: Re: Batch File - Building a Library
Post by: dedndave on January 26, 2014, 04:43:57 AM
it generally works ok
but if any modules have errors, you may be in for a bumpy ride
that tells me that it's less than ideal, even if the modules have no errors

another place a response file is used is during installation of the Masm32 package
it seems to be a processor-intensive operation, and has even been problematic in some cases
perhaps the FOR loop method would relieve some of those issues
Title: Re: Batch File - Building a Library
Post by: jj2007 on January 26, 2014, 04:57:33 AM
Quote from: dedndave on January 26, 2014, 04:43:57 AM
but if any modules have errors, you may be in for a bumpy ride
Well, kind of... I do have errors sometimes, and one problem is that errorlevel doesn't work, so you have to detect it with different methods (i.e. checking the output):
   \Masm32\bin\%oAssembler% /c /coff @libtmpXY.rsp
   if errorlevel 0 goto okml


What I find definitely annoying is that even when there is an error in the first source, ML continues to assemble all my 26 source files - and it's so slow...
No way to make it exit, even with Dave's for loop it just continues... :(
Title: Re: Batch File - Building a Library
Post by: Vortex on January 26, 2014, 05:04:55 AM
If you are working in the MSYS environment :


for f in *.asm
   do
         /d/masm32/bin/ml.exe /ID:\masm32/include //c //coff $f
   done


http://www.mingw.org/wiki/MSYS