Building Multi-module projects using GoAsm

Started by donkey, January 03, 2005, 02:06:51 AM

Previous topic - Next topic

donkey

One of the great advantages of modern compiler systems is that you can break a project down into manageable parts. The easiest and best way to do this is with obj modules. Each unique section of a program is assembled separately into an OBJ file then the final link brings them all together into a single program. The major advantage of this is that you can more easily port a module to another project as well as not waste time assembling it for every build. Once it has been assembled once, it need not be done again unless that particular module has been changed. In GoAsm you use a command file to specify the obj files to link, the rest is easy. I will possibly write a small add-in for RadASM that will build the mkf file automatically prior to a build, it is a fairly simple program.

Assembling Modules:

C:\GoAsm\BIN\GoAsm.EXE /c "Modules\Module1.asm"

In RadASM you set the "Assemble Modules" feild of "Project Options" to :

*.obj,O,$B\GoAsm.EXE /c,*.asm

The /c ensures that the OBJ file will be created in the current directory, this is important when you link them as it makes things much easier to deal with.

The Modules.MKF file consists of all of the OBJ files you wish to link and the order they are to be linked in. Remember that constants must be defined on a per-module basis so watch for dependancies between modules.

--------------Modules.mkf
MainProggie.obj
module1.obj
module2.obj
--------------

Finally you link the project as follows...

C:\GoAsm\BIN\GoLink.EXE @C:\GoAsm\BIN\GFL.txt @Modules.MKF /entry Start "MainProggie.res"

In RadASM you set the "Link" feild of "Project Options" to :

5,O,$B\GoLink.EXE @$B\GFL.txt @Modules.MKF /entry Start,4
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

donkey

#1
I threw together a quick addin for RadASM that automates the process. You have to add the following to GoAsm.ini...

[Project]
Type=Win32 App,Win9x Unicode,Win32 App (no res),DLL,Console,LIB,MultiLink

[MultiLink]
Files=1,1,0,1,0
Folders=1,0,1
MenuMake=1,1,1,1,1,1,1,1,0,0,1
;x=FileToDelete/CheckExistsOnExit,
;(O)utput/(C)onsole/0,Command,
;MakeFile1[,MakeFile2[,MakeFile3...]]
1=4,O,$B\GORC.EXE /r,1
2=3,O,$B\GoAsm.EXE,2
3=5,O,$B\GoLink.EXE @$B\GFL.txt @"$10" /entry Start,4
4=0,0,,5
5=
6=*.obj,O,$B\GoAsm.EXE,*.asm
7=0,0,\GoAsm\GoBug\GoBug,5
8=5,O,$B\GoLink.EXE @$B\GFL.txt @"$10" /unused /entry Start,4
11=4,O,$B\GORC.EXE /r,1
12=3,O,$B\GoAsm.EXE,2
13=5,O,$B\GoLink.EXE @$B\GFL.txt @"$10" /debug coff /entry Start,4
14=0,0,,5
15=
16=*.obj,O,$B\GoAsm.EXE,*.asm
17=0,0,\GoAsm\GoBug\GoBug,5
18=5,O,$B\GoLink.EXE @$B\GFL.txt @"$10" /debug coff /unused /entry Start,4


Then copy the accompanying DLL to the Addins folder and enable it using AddIn Manager

[attachment deleted by admin]
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable