Author Topic: problem assembling 32 bit application using /Zi switch  (Read 565 times)

markallyn

  • Member
  • **
  • Posts: 192
problem assembling 32 bit application using /Zi switch
« on: February 27, 2018, 08:08:23 AM »
Hello everyone,

I ran into a problem with a .bat file when setting the /Zi switch in 32 bit code.  The .bat file looked something like this:

Quote
@echo off
if exist 32bit.obj del 32bit.obj
ml /c /Zi 32bit.asm
link /subsystem:console /entry:main /debug /pdb:32bit.pdb 32bit.obj
pause

In the 32bit app there was an invocation of crt_printf.  The above code would assemble, but the link step kept failing.  Two problems identified:  first, it couldn't resolve the reference to __imp_printf.  Second, it said the .obj file was not a coff file.  Much head scratching ensued and wrecked the day.  Until...

I changed the .bat file to this:

Quote
@echo off
if exist 32bit.obj del 32bit.obj
ml /c /Zi /coff 32bit.asm
link /subsystem:console /entry:main /debug /pdb:32bit.pdb 32bit.obj
pause

So the /coff switch seemed to be essential in order for the .obj file to not be messed up with debug symbols.  And the problem with symbol resolution also went away.

No doubt many of you folks are aware of this issue.  I had not run into it doing similar .bat files for 64 bit masm code.  Am I missing something important here?

regards,
Mark Allyn