The MASM Forum

64 bit assembler => UASM Assembler Development => Topic started by: Vortex on May 17, 2021, 05:51:32 PM

Title: Import libraries for UASM
Post by: Vortex on May 17, 2021, 05:51:32 PM
Hello,

I think adding an option to the UASM package to create import libraries should be possible. What about creating 32-bit import libraries from module definition files? The .def file can be extracted from Pelles libraries or MS VC.  64-bit libraries can be created from DLLs since they are not decorated.
Title: Re: Import libraries for UASM
Post by: TouEnMasm on May 17, 2021, 11:03:10 PM

For what need ?
Title: Re: Import libraries for UASM
Post by: Vortex on May 17, 2021, 11:15:50 PM
Easy. The Masm32 and Asmc packages are providing their own import library sets. UASM could provide the same system.

A quick example, here is how to extract the def files from import libraries and regenerating them :

The DOS batch file creating the .def files :

For %%a IN (\PellesC\lib\Win\*.lib) Do @( \PellesC\bin\Polib.exe /MACHINE:x86 /MAKEDEF:%%~na.def %%~fa  )

The batch file creating the import libraries :

For %%a IN (*.def) Do @( \PellesC\bin\Polib.exe /MACHINE:x86 /DEF:%%a /OUT:%%~na.lib )

Adding the .def files and the necessary batch files to the UASM package would do the job.
Title: Re: Import libraries for UASM
Post by: fearless on May 20, 2021, 08:57:18 PM
I forgot that I created this, which might be useful: https://github.com/mrfearless/Dll2Def (https://github.com/mrfearless/Dll2Def). Could include that with any distribution and run a batch file with commands to create the .def files then convert the .def to .lib

Dll2Def supports * wildcard. I think i coded it to support x64 dll's as well.
Title: Re: Import libraries for UASM
Post by: Vortex on August 14, 2023, 07:28:51 PM
Hi John and Branislav,

Any plans to add an option to the Uasm package to build import libraries?
Title: Re: Import libraries for UASM
Post by: johnsa on October 20, 2023, 06:59:40 PM
It's not something I'd considered, I'd normally just do this on demand as I required it per dll/def file as there isn't anything in UASM itself to do this. I'm happy to include an additional tool in the package to do this if someone has one, possibly this Dll2Def?

Title: Re: Import libraries for UASM
Post by: fearless on October 20, 2023, 11:04:07 PM
Feel free to include Dll2Def in any package if you want.
Title: Re: Import libraries for UASM
Post by: johnsa on October 21, 2023, 06:17:08 AM
Thanks Fearless!
Title: Re: Import libraries for UASM
Post by: Vortex on October 22, 2023, 04:25:46 AM
Hi John,

For 32-bit programming, you need decorated import libraries. I can extract the module definitions files from the Masm32 import libraries and supply my def2lib tool, plus a batch file to create the libraries. Is it OK for you?
Title: Re: Import libraries for UASM
Post by: johnsa on October 22, 2023, 10:38:25 PM
Yep, that sounds great!
Title: Re: Import libraries for UASM
Post by: Vortex on October 23, 2023, 06:48:48 AM
Hi John,

Here is the zip file containing the .def files and the tools def2lib & lib2def :

http://vortex.masmcode.com/files/DefFiles1.zip (http://vortex.masmcode.com/files/DefFiles1.zip)

Jotti's report :

https://virusscan.jotti.org/en-US/filescanjob/3kb48biu4m (https://virusscan.jotti.org/en-US/filescanjob/3kb48biu4m)

You can run MakeLib.bat to create the import libraries :

def2lib *.def

def2lib ntvdm.def -e

The .def files are extracted from the Masm32 import libraries, many thanks to Hutch :

MakeDef.bat :

lib2def G:\masm32\lib\*.lib
del bhsupp.def
del dpserial.def
del dpwsock.def
del dststlog.def
del kernl32p.def
del masm32.def

Some import libraries with no exports are eliminated