Hutch, during my many years of programming under DOS, I've always used a modular approach i.e. splitting my source code into different files each one dealing with a specific part of the program. This was achieved by placing a label at the start of each file and then referencing it from my main program interface, when I tried to do this in MASM32 I got assembler errors like illegal use of global or local label. Does this mean I have to have all my source code in one (huge) file
Posted on 2001-08-07 14:53:40 by Mel
This was posted by Karim in another post but its an example of what your looking to do.

Good luck,
Posted on 2001-08-07 16:52:55 by Betrayed

There are a couple of ways of doing modular coding in MASM, the INCLUDE directive is probably the most flexible as it allows you to add complete files that retain the scope of the GLOBAL variables in the data sections. You can include parts of files or just small bits which have algorithms at any point in your code.

The alternative approach is the seperate module which can either be linked into the main program with LINK options or alternatively, you build a set of seperate modules into a library and include the library with the INCLUDELIB directive. In the second approach, I prefer the library method as it is fully extendable to as many modules as you like and it does not need the individual files added to the link command line.

The MASM32 lib is built this way and there is a plugin DLL in MASM32 for writing library modules. The code wizaed prostart uses the INCLUDE directive for seperate files so that the source is not concentrated in one larger file.

Posted on 2001-08-07 19:03:46 by hutch--
Afternoon, Mel.

Use 'EXTERNDEF' in each of your modules for each proc or definition you need to make accessible.

Look up how to use this directive in the QEditor MASM Reference. Depending on which file you declare the proc, etc in, it'll declare your proc as external, public, or not at all.:alright:

Posted on 2001-08-08 01:30:26 by Scronty
Thanks Hutch, I had a feeling it must be possible to do this but I needed someone to point me in the right direction. The library approach looks the most flexible way to go and I shall go along with that:alright:
Posted on 2001-08-08 01:32:14 by Mel
Also thanks for your tips Scronty & Betrayed, most informative:alright:
Posted on 2001-08-08 01:34:57 by Mel