News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Libraries in Assembly

Started by mebob55, May 31, 2010, 01:16:42 AM

Previous topic - Next topic

mebob55

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++.

clive

It could be a random act of randomness. Those happen a lot as well.

ecube

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);
}