Hi everyone, I'm trying to create my own static library (no dll, just a .lib file). The make.bat file is like this: ml /c /coff test.asm lib /subsystem:windows /def:test.def test.obj and the definition file: LIBRARY test EXPORTS func1 func2 Now it seems like my libfile doesn't include anything at all, just function definitions and somewhere in the file the string 'test.dll' appears although I didn't create a dll. If I leave the definition file out (no /def:test.def), everything is included in the libfile, but I want to export SOME functions, not all of them (btw are the functions that you don't export included?).. Am I doing something wrong? Thanx, Thomas
Posted on 2000-11-18 19:25:00 by Thomas
To make a library (.lib) you dont need a lib file, assemle the source. To link it into a library, use the following: lib test.obj /out:masm32.lib This will create test.lib To build an include file: l2incA /M test.lib If you only want export some functions from the library, try using after the proc; private. e.g: funcname proc private Param1:DWORD The default (instead of private) is public functions which be exported.
Posted on 2000-11-18 21:17:00 by rorge
Thomas, These 2 lines build all of the assembler modules in the current directory. \masm32\bin\ml /c /coff *.asm \masm32\bin\lib *.obj /out:masm32.lib Below is a sample template for writing a library module, its produced by a plug in DLL in MASM32. Regards, hutch@pbq.com.au ; ############################################################# .386 ; force 32 bit code .model flat, stdcall ; memory model & calling convention option casemap :none ; case sensitive ; -------------------------------- ; Include any needed INCLUDE files ; -------------------------------- ; include \masm32\include\windows.inc ; include \masm32\include\gdi32.inc ; include \masm32\include\user32.inc ; include \masm32\include\masm32.inc ; --------------------------------------------------------- ; Write the prototype for the procedure name below ensuring ; that the parameter count & size match and put it in your ; library include file. ; --------------------------------------------------------- ; AsmModule PROTO :DWORD,:DWORD etc..... .code ; ############################################################# AsmModule proc par1:DWORD,par2:DWORD etc..... ; Write you code here ret AsmModule endp ; ############################################################# end
Posted on 2000-11-19 00:50:00 by hutch--
Pardom me jumping in, but isn't there already a fine library of functions named masm32.lib? I would suggest another name for this.
Posted on 2000-11-19 02:36:00 by TTom
Thanks for all your replies, but I have another question. Imagine I have this code: Function1 PROTO STDCALL :DWORD internalfunction PROTO STDCALL :DWORD, :DWORD .code Function1 proc param:DWORD ;do something invoke internalfunction, eax, ecx ret Function1 endp internalfunction proc param1:DWORD, param2:DWORD ;do something ret internalfunction endp Now, I only want to export Function1, not internalfunction. How can I do this? internalfunction should be included of course because it's used by function1, but it shouldn't be exported. Thomas
Posted on 2000-11-19 05:26:00 by Thomas
Sure, no problem. Just include only the functions you want exported in the .def file. Personally, I write my own .inc files for my .dll's, so I can include other things like constants in there too.
Posted on 2000-11-19 16:31:00 by TTom
I still have the same problem, I can't get the right functions to be exported. When I use a .def file, it assumes I have a dll when I use the library in an other program, when I don't use a .def file, it exports all functions... I don't want a dll, I just want a library like the masm32.lib in the win32asm package, but some internal functions should not be exported.. Is there an example of this somewhere?
Posted on 2000-11-19 18:02:00 by Thomas
Here's an example of what I'm trying to do: http://www.exagone.f2s.com/temp/librarytest.zip Please take a look at it. Thomas.
Posted on 2000-11-20 07:58:00 by Thomas