The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Biterider on March 07, 2006, 03:09:04 PM

Title: Erratic MASM compilation problems
Post by: Biterider on March 07, 2006, 03:09:04 PM
Hi,
In my spare free time I'm building a CAD system in ASM using MASM. It's becoming a large app so I decide to use libraries to reduce the compilation time. Since a while I'm experimenting a strange effect, that when I replace the libs with the original code, MASM are refusing to compile giving me strange error messages like "error A2008: syntax error: typedef" on lines where not typedef plays a role. If I reduce the project, the error disappears.

Any idea what is happening?

Regards,

Biterider
Title: Re: Erratic MASM compilation problems
Post by: PBrennick on March 07, 2006, 05:39:58 PM
Biterider,
This is probably due to the fact that the error reporting sometimes does not report the correct line but is actually a line nearby.  You should probably search the file for all examples of typedef, for example, and disregard those that are not close to the line reported and you should be able to figure out which is the one.

One of the things that I usually do is pipe messages coming from the assembler to a temporary file such as errors.txt.  If there is no errors then delete error.txt

If there are errors you have a text file that contains them so you can pick away at them at your leasure.

Paul
Title: Re: Erratic MASM compilation problems
Post by: P1 on March 07, 2006, 08:06:03 PM
Paul is right on!  Never rely on what you saw, always dump a complex build.  Here is my line line from bldall.bat.
\masm32\bin\ml /c /coff "%1.asm" > "%1.txt"
-or-
\masm32\bin\ml /c /coff /Fl"%1.lst" /FR"%1.pdb" /Sa /Zd /Zf /Zi  "%1.asm" > "%1.txt"


When debugging, I use a lst file.  This forces MASM to document the whole error.

Regards,  P1  :8)
Title: Re: Erratic MASM compilation problems
Post by: Mark Jones on March 07, 2006, 08:23:54 PM
Hey Byterider. Here's some general notes from my limited experience. If you are compiling multiple modules at once, make sure each module has the PROTOs for any inter-module calls in THAT module, PLUS all other modules where each function is used. For example you have main.asm, module1.asm, module2.asm and module3.asm. Module3 has two functions which call each other in module3, so both PROTOs are needed in module3. Main.asm calls only one function from module3.asm so only that one PROTO is needed in main.asm.

Local functions with no parameters do not need PROTOs at all and can be either INVOKEd or CALLed. But across modules, function calls might need a PROTO - so the compiler knows wether the call is going short or far (unverified.)

Also make sure all modules consist of PROCS with no code, labels, or END statements outside the procedures. I've witnessed very unusual behavior from modules having an END statement in them.

Alas you also know that "::" denotes global labels... it is feasible that duplicate labels in different modules could cause some contention at assembly-time. Again just an observation. Good luck! :bg
Title: Re: Erratic MASM compilation problems
Post by: hutch-- on March 09, 2006, 01:29:40 PM
Biterider,

There is another effect that I have noticed when I have reconstructed very large assembler dumps with IDA Pro. over a certain count, (64k) it starts to report the wrong line numbers for errors and showed inconsistent behaviour in a number of other things so it appears that masm has definite limits in how large a file it will reliably build. With properly modularised code, it is rarely a problem as each module is not big enough but group them all together and it probably exceeds some of the capacities in masm to build a file of that size.

I once tried to construct a byte tree using the .IF block syntax but over a certain nesting level it ran out of puff and generated errors. It does not have this limit when you work on near pure mnemonic code.