The MASM Forum Archive 2004 to 2012

Project Support Forums => GoAsm Assembler and Tools => Topic started by: donkey on April 05, 2011, 09:44:48 PM

Title: Tip when building LIB files with GoAsm and MS Lib.exe
Post by: donkey on April 05, 2011, 09:44:48 PM
I have been building a couple of LIB projects over the last few weeks and have a tip to pass along. If your LIB is meant to be used by MASM as well as GoAsm, it is important not to use the directive #dynamiclinkfile anywhere in the source since when you try to build a MASM project using the LIB you'll get a LNK1276 error "invalid directive 'directive' found; does not start with '/'". This appears to be because GoAsm uses the directive section of the PE to store the DLL's to be searched at link time, however ML.EXE also uses that section to pass instructions to the linker and the two are incompatible. Since MASM's link.exe does not recognize these directives it will throw that error. The DLL imports are not necessary when building a LIB and should always be left out, that includes not defining the LINKFILES switch for the header project.
Title: Re: Tip when building LIB files with GoAsm and MS Lib.exe
Post by: dedndave on April 11, 2011, 05:20:03 PM
not sure i understand, Edgar

if i build a static library that requires, say...
        INCLUDE    \masm32\include\advapi32.inc
        INCLUDELIB \masm32\lib\advapi32.lib


are you saying i should leave out the INCLUDELIB ???
Title: Re: Tip when building LIB files with GoAsm and MS Lib.exe
Post by: donkey on April 11, 2011, 10:03:12 PM
Hi Dave,

In MASM as in GoAsm calling the lib will work as usual, this tip was for the building of the static library itself using GoAsm. The reason for this is how GoAsm (and MASM) pass directives to the linker which are completely incompatible since the inclusion of the #dynamiclinkfile directive in GoAsm, it has to left out of the lib build in GoAsm. Beyond that the output of GoAsm is COFF and you would use MS Lib.exe so the two assemblers can read each others static libraries. As you know GoAsm does not use import libraries so the includelib directive doesn't really apply.
Title: Re: Tip when building LIB files with GoAsm and MS Lib.exe
Post by: dedndave on April 11, 2011, 10:17:18 PM
i see - well, i would not use that directive anyways
but it is nice to know how to write files so they may be built using either assembler   :bg