News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

how to include large modules at compile time or link time

Started by shankle, May 13, 2013, 10:04:06 PM

Previous topic - Next topic

shankle

Converting a large system to GoAsm from Masm32.
Have several large modules that are used many times in the system. Should I just compile
them and included them at link time and how to do it? How do I go about doing this or
should I just code them in the programs and compile and link?
Where can I read about this? An example would be nice.
Thanks for any help.

Vortex

Hi shanke,

GoLink is supporting static libraries built from MS COFF object modules. Try to make static libraries to make easy the convertion process.

shankle

Thank you for replying Vortex.
More details of where to read about this or a small example is what I need.
I found this in the GoAsm Help files. I assume this means that I can not use my GoAsm
code as is in a ".lib" file. Have no idea how to do this.
Static code libraries are files with the ".lib" extension containing one or more COFF object files. The object files contain code and data for ready-made functions. The material inside the library file is in binary format (machine code) not source code. The library file contains an index with a list of the functions and the code and data labels they use. Static code libraries should be distinguished from dynamically linked libraries (DLLs) and from import libraries which merely contain a list of functions exported by DLLs.

I'm still very green with GoAsm.

Vortex

Hi shankle,

Here is a quick example for you :

#define uppercase testlib.lib:uppercase
#define lowercase testlib.lib:lowercase
#define StdOut testlib.lib:StdOut

.data

str1    db 'string converted to uppercase.',13,10,0
str2    db 'THIS STRING CONVERTED TO LOWERCASE.',0

.code

start:

    invoke  uppercase,ADDR str1
    invoke  StdOut,eax
    invoke  lowercase,ADDR str2
    invoke  StdOut,eax
    invoke  ExitProcess,0

shankle

Why go through the hassle of all these complicated links to use repetitive data?
If your anything like me, 5 years from now you won't remember what you did.
For me that's yesterday :biggrin:
The reason I am questioning the validity of using this technique is that the execute
module is the same size no matter which way you do it. So why bother and it makes
the code so much easier to follow.
I guess you guys will come down hard on me for this statement.......

wjr

A LIB file can make more sense with a group of stable functions used by several projects.

In your case though, it seems like assembling several modules and then linking them would be easiest. If the command line for GoLink is getting too long with link options, several OBJ files and DLL files, you can use a Command File instead (see near the start of the GoLink help file).

The above keeps the source simple with a more complex build process. I am not sure what you had in mind with "just code them in the programs", but #include can be used to include other ASM files. This can make the build process a bit easier, but adds more to the source files. I would lean more towards the first method.

Vortex