The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: mebob55 on May 31, 2010, 01:16:42 AM

Title: Libraries in Assembly
Post by: mebob55 on May 31, 2010, 01:16:42 AM
This is probably a really stupid question with a really simple answer, but how do you make a static library in assembly? I wanted to make static libraries in assembly and use them in Visual C++.
Title: Re: Libraries in Assembly
Post by: clive on May 31, 2010, 02:06:25 AM
Take a look at this,
http://www.masm32.com/board/index.php?topic=14078.0
Title: Re: Libraries in Assembly
Post by: ecube on May 31, 2010, 09:08:08 AM
That link pretty confusing clive, he's a more straightforward approach

;yourlib.asm

include \masm32\include\masm32rt.inc
myfunction  proto C :DWORD

.code
myfunction proc C param1:DWORD
;do whatever
ret
myfunction endp

end


;build.bat

\MASM32\BIN\ML /c /coff yourlib.asm
\MASM32\BIN\link -lib /LIBPATH:\masm32\lib yourlib.obj
pause



;test.c

#include <stdio.h>
#pragma comment(lib, "yourlib.lib");
int main()
{
myfunction(1);
}