The MASM Forum

General => The Workshop => Topic started by: Oliver Scantleberry on July 21, 2015, 07:59:10 AM

Title: Invoke link separately or allow ml to do it.
Post by: Oliver Scantleberry on July 21, 2015, 07:59:10 AM
I haven't done any assembly work in several years. I have several batch files for the purpose of assembling and linking programs. All of them  assemble the file then, in a separate line, invoke the link program. Is there any reason not to allow the ml (assembler) do it? I use macro assembler version 10 and 11 depending on whether I'm in my Irvine directory or the MASM32 directory.

Thanks for any info. I'm new on the forum, by the way.
Title: Re: Invoke link separately or allow ml to do it.
Post by: jj2007 on July 21, 2015, 08:07:24 AM
Hi Oliver,

Main reason for separating assembling and linking is flexibility for the latter. You can link together object modules and resources etc if you do it separately.

Welcome to the forum :icon14:

Title: Re: Invoke link separately or allow ml to do it.
Post by: rrr314159 on July 21, 2015, 08:59:57 AM
hi Oliver, and welcome,

jj2007's right, as usual. Having said that go ahead and use ml's link option if you want, as long as it works for you (i.e. as long as you only have one file and are content with ml assembler and linker, as opposed to alternatives such as H/JWasm or Pelle's linker). BTW I use batch files myself, instead of the menus or an IDE - it's very flexible and just as easy once you get used to it. Keep at it, good luck, and may all your bugs be easy to find and fix ...
Title: Re: Invoke link separately or allow ml to do it.
Post by: hutch-- on July 21, 2015, 09:03:12 AM
Hi Oliver,

welcome on board. The 32 bit versions of ML are best used to create object modules which can be linked into EXE, DLL or a collection that can be made into a library. It gives you the choice of which linker you want and more flexible options when running the linker.
Title: Re: Invoke link separately or allow ml to do it.
Post by: Oliver Scantleberry on July 21, 2015, 01:10:32 PM
Thanks, Hutch.

So you also think a separate line to invoke the linker is better?
Title: Re: Invoke link separately or allow ml to do it.
Post by: hutch-- on July 21, 2015, 02:52:41 PM
It certainly is. The combined assemble and link is a left over of a simpler era of 16 bit DOS programming. Once you are used to it you will assemble object modules with ML.EXE, compile resource modules with RC.EXE and then link them all together with LINK.EXE.
Title: Re: Invoke link separately or allow ml to do it.
Post by: Gunther on July 21, 2015, 09:53:17 PM
Hi Oliver,

I think your question is answered by Jochen and Hutch. Welcome to the forum.

Gunther
Title: Re: Invoke link separately or allow ml to do it.
Post by: Oliver Scantleberry on July 22, 2015, 12:44:56 PM
hutch, rc.exe and resource modules are brand new to me. Where do I find out more about these resource thing?. How to use them and why I would want to.
Title: Re: Invoke link separately or allow ml to do it.
Post by: dedndave on July 22, 2015, 12:56:53 PM
microsoft's page - notice further reading at links in left pane

https://msdn.microsoft.com/en-us/library/windows/desktop/aa381042%28v=vs.85%29.aspx (https://msdn.microsoft.com/en-us/library/windows/desktop/aa381042%28v=vs.85%29.aspx)

also, there is a help file in the masm32\bin folder, rc.hlp

resource files allow you to add several types of data to the executable
including dialogs, accelerators, menus, etc

you can also add data like icons, images, sound files, fonts, and so on
the contents you add will be added to the executable

another important feature is the ability to add a manifest, in the form of an XML file
Title: Re: Invoke link separately or allow ml to do it.
Post by: hutch-- on July 22, 2015, 02:12:21 PM
Oliver,

There is some advantage in using separate resource scripts, you can use dialog editors to create dialog templates, set a manifest that matters in later OS versions from Vista upwards, set a version control block so that the OS can identify the executable and you can also use a separate image editor to do bitmaps and icons.

This is of course mainly for UI style apps that use a Window but some of this does not apply to a console app.
Title: Re: Invoke link separately or allow ml to do it.
Post by: Oliver Scantleberry on July 23, 2015, 03:39:19 AM
Thanks guys. I only do console apps but some of it may be helpful. Who knows?
Title: Re: Invoke link separately or allow ml to do it.
Post by: xanatose on July 23, 2015, 04:01:12 AM
Quote from: rrr314159 on July 21, 2015, 08:59:57 AM
good luck, and may all your bugs be easy to find and fix ...

Amen to that.

This will make for a good saying on a coffee cup.