Hi friends,
Working on import libraries, I found a very easy way to add static code to an import library. Pelle's librarian polib has the capacity do this :
\masm32\bin\ml /c /coff \masm32\m32lib\StdOut.asm
\masm32\bin\ml /c /coff \masm32\m32lib\StrLen.asm
\masm32\bin\polib /OUT:kernel32.lib /DEF:kernel32.def /MACHINE:IX86
\masm32\bin\polib /OUT:mixed.lib kernel32.lib StdOut.obj StrLen.obj
kernel32.lib is created from kernel32.def and the the library is updated with the addition of two functions from masm32.lib
You use the resulting import library to link your object files :
.386
.model flat, stdcall
option casemap:none
include \masm32\include\kernel32.inc
include \masm32\include\masm32.inc
includelib mixed.lib
.data
message db 'Hello from mixed lib!',0
.code
start:
invoke StdOut,ADDR message
invoke ExitProcess,0
END start
[attachment deleted by admin]
Very nice :U
Erol,
This is well done and very useful. :U
Zooba, Hutch,
Thanks for your kind words.
Here is another version of the mixed library. I merged kernel32.lib, user32.lib, gdi32.lib and masm32.lib to build mrt.lib ( Masm run-time library )
\masm32\bin\polib /OUT:kernel32.lib /DEF:def\kernel32.def /MACHINE:IX86
\masm32\bin\polib /OUT:user32.lib /DEF:def\user32.def /MACHINE:IX86
\masm32\bin\polib /OUT:gdi32.lib /DEF:def\gdi32.def /MACHINE:IX86
\masm32\bin\polib /OUT:mrt.lib kernel32.lib user32.lib gdi32.lib \masm32\lib\masm32.lib
A small demo using mrt.lib :
include mrt.inc
.data
message db 'Hello from mrt.lib!',0
.code
start:
invoke StdOut,ADDR message
invoke ExitProcess,0
END start
http://vortex.masmcode.com/files/mrt1.zip
Vortex,
I really like that one! VERY useful. We should do something like that.
Paul
I was thinking to myself how convenient it would be for a newcomer to just include one file and not have to worry about any other includes... so why not build a master include library?
Mark,
You have read my mind. Master.inc and Master.lib, coming soon to a project near you!
Paul
Paul, what about renaming the library to GSmrt.lib?
GSmrt.lib = GeneSys master run-time library