Author Topic: how to include large modules at compile time or link time  (Read 3774 times)

shankle

  • Member
  • ****
  • Posts: 847
how to include large modules at compile time or link time
« on: May 13, 2013, 10:04:06 PM »
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

  • Member
  • *****
  • Posts: 2104
Re: how to include large modules at compile time or link time
« Reply #1 on: May 14, 2013, 05:13:59 AM »
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

  • Member
  • ****
  • Posts: 847
Re: how to include large modules at compile time or link time
« Reply #2 on: May 14, 2013, 06:55:14 AM »
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.
« Last Edit: May 14, 2013, 07:58:17 AM by shankle »

Vortex

  • Member
  • *****
  • Posts: 2104
Re: how to include large modules at compile time or link time
« Reply #3 on: May 15, 2013, 03:06:48 AM »
Hi shankle,

Here is a quick example for you :

Code: [Select]
#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

  • Member
  • ****
  • Posts: 847
Re: how to include large modules at compile time or link time
« Reply #4 on: May 18, 2013, 06:45:16 AM »
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

  • Member
  • **
  • Posts: 210
    • WJR's website
Re: how to include large modules at compile time or link time
« Reply #5 on: May 18, 2013, 09:47:09 AM »
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

  • Member
  • *****
  • Posts: 2104
Re: how to include large modules at compile time or link time
« Reply #6 on: May 18, 2013, 04:55:47 PM »
Hi shankle,

Could you present us a better method?