The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: tehbatz on November 25, 2007, 11:36:21 PM

Title: Compiling *.asm to *.lib help
Post by: tehbatz on November 25, 2007, 11:36:21 PM
how do you compile a *.asm file to a *.lib file?

I use this batch file to compile it to a dll:
-----CODE------
@echo off
echo press any key to compile
pause > nul
if exist N3xuiZ PE.obj del "the.obj"
if exist N3xuiZ PE.dll del "the.dll"
C:\masm32\bin\ml /c /coff "the.Asm"
C:\masm32\bin\Link /SUBSYSTEM:WINDOWS /DLL "the.obj"

echo compilation complete
echo press any key to comtinue
Pause > nul
-----CODE------

Thanks.
Title: Re: Compiling *.asm to *.lib help
Post by: ragdog on November 25, 2007, 11:41:31 PM
hi

use this

    \masm32\bin\ml /c /coff test.asm
    \masm32\bin\lib test.obj /out:test.lib

greets
ragdog
Title: Re: Compiling *.asm to *.lib help
Post by: tehbatz on November 25, 2007, 11:55:37 PM
Thanks sooooooooooo much! :U
Title: Re: Compiling *.asm to *.lib help
Post by: zoncpp on February 03, 2009, 12:28:52 PM
Hi!
this command :  \masm32\bin\ml /c /coff test.asm  , create an obj file, but this obj file is not valid for other project for using.
i want an object file (created of *.asm) that i add this file in other project (VC or Delphi). how do i create this object file?
Title: Re: Compiling *.asm to *.lib help
Post by: Vortex on February 03, 2009, 06:24:56 PM
\masm32\bin\polib /OUT:mylibrary.lib objfile1.obj objfile2.obj objfile3.obj
Title: Re: Compiling *.asm to *.lib help
Post by: zoncpp on February 04, 2009, 06:54:06 AM
i created myFile.lib with this code:
\masm32\bin\ml /c /coff myFile.asm
\masm32\bin\lib myFile.obj /out:myFile.lib



in this code :
\masm32\bin\polib /OUT:myFile.lib objfile1.obj objfile2.obj objfile3.obj
what is objfile1.obj and objfile2.obj and objfile3.obj?

what do i do?
Title: Re: Compiling *.asm to *.lib help
Post by: Vortex on February 04, 2009, 06:01:55 PM
You can create a static library from multiple object modules not just only from one object file. If you have one file :

polib /OUT:myFile.lib myFile.obj


If you have more than one object module :

polib /OUT:myFile.lib myFile1.obj myFile2.obj etc.

Title: Re: Compiling *.asm to *.lib help
Post by: zoncpp on February 05, 2009, 05:47:30 AM
oh, yes, ok. but my problem dos not resolve.
i want an object file from an asm file. AND this object file will be used in VC or Delphi projects
Title: Re: Compiling *.asm to *.lib help
Post by: Vortex on February 05, 2009, 09:26:57 PM
Delphi is using the OMF object module format :

\masm32\bin\ml /c sourcecode.asm ; this creates an OMF module

VC and Pelles C are using the MS COFF format :

\masm32\bin\ml /c /coff sourcecode.asm

Have a look at Elicz's OMF2D tool to convert OMF modules to Delphi type OMF modules :

http://www.apihooks.com/EliCZ/export.htm
Title: Re: Compiling *.asm to *.lib help
Post by: zoncpp on February 07, 2009, 11:19:03 AM
thank you, very much.
i used OMF object that has been created by OMF2D, in delphi project. thanks.
\masm32\bin\ml /c sourcecode.asm
omf2d.exe sourcecode.obj


But... in VC project, ...
Title: Re: Compiling *.asm to *.lib help
Post by: Vortex on February 07, 2009, 12:14:33 PM
Hi zoncpp,

VC accepts regular MS COFF object modules so creating a static library should be OK for you.
Title: Re: Compiling *.asm to *.lib help
Post by: zoncpp on February 07, 2009, 12:44:12 PM
thank you Vortex !
i used a static library in VC.
ok , i will endeavor a little and if i had not be success, then i will work with static library.