Is it possible to convert '.DLL -> .LIB (Perfect static library: *No DLL export library*)'

Is there any converting tool?

Thank you for reading!
Have a nice day!
Posted on 2002-07-29 09:50:34 by nyam
there is a product named dll2lib but it is commercia app if you dont register it show messagebox eveytime you call proc inside this dll.Usage is alittle bit tricky with asm.
1) Make lib file with dll2lib.
2) Making include file is alittle bit hard.l2inca only recognized one function from this libs XXX_DLLMAIN(I will talk about this function).If you can find any library to get function prototypes you are lucky if not you should make inc file yourself.First you should identify if it is C function or STDCALL function and number of parameters that function takes
if it is STDCALL function
Prototype is like that.
externdef _imp__functionname :ptr prnumberofparameters
functionname equ <_imp__functionname>

else
functionname PROTO C :DWORD,:VARARG
3) You should also have libc.lib,oldnames.lib etc from VC dir.
4) In order to use any function from dll you should use this notation

in the start of your app you should initialize the dll2lib produced lib

invoke XXX_DllMain,hInst,DLL_PROCESS_ATTACH,0
invoke myfunction,.........

;and before exit your app
invoke XXX_DllMain,hInst,DLL_PROCESS_DETACH,0
invoke ExitProcess,0

I tried on few dlls and it works but because it is shareware and show ugly messageboxes I dont recommend you to use.
Posted on 2002-07-29 10:34:30 by LaptoniC
I agree with LaptoniC here, the program is a novel idea but its commercialware and there is no garrantee that it will work in all cases.

An alternative approach is to use a tool from Jeremy Collake's site that embeds the DLL directly into you EXE file. You use it like a normal DLL.

Look up collakesoftware in google to find the site.

Regards,

hutch@movsd.com
Posted on 2002-07-29 10:59:31 by hutch--
I'm happy to hear that there is 'DLL2LIB' program. :)

Thanks LaptoniC for replying kind and good example.

Thanks hutch-- for showing other resolution.
(I have used 'PEBundle'. :) But, It cannot bundle all DLL. :( )

Thank you!
Posted on 2002-07-29 19:28:19 by nyam
There is a freeware tool available wich runs on Linux and Cygwin, wich converts Windows DLL's to Windows LIB's :)

http://howtohack.sourceforge.net/dlltool/
Posted on 2002-07-30 00:56:40 by bazik
baZik...

It seems to be 'a DLL -> *SIMPLE DLL export library*'

The .LIB has no *REAL* DLL code.
It only has informations to link to DLL dynamically.

I have not test the tool from cygwin.
So, I may be wrong... :(
Posted on 2002-07-30 01:04:56 by nyam
I've only played a little with DLL2LIB. It wasn't able to convert the DLL I was
interested in, and I haven't needed it afterwards. I see the advantage over
PEBundle that your code pages will not be marked dirty, and the disadvantage
over normal DLLs that the DLL code wont be shared (but it probably wouldn't
anyway if you intend on merging the DLL with the exe). Furthermore, I very
much doubt that DLL2LIB can do function splitting like normal libraries can,
which could give you some possibly very bloated executables.
Posted on 2002-07-30 08:10:58 by f0dder
Function splitting?
Posted on 2002-07-30 12:44:00 by comrade
Only pulling in the functions from the lib you need, accomplished by putting each
function in it's own .obj (or using some funky stuff like microsoft does). DLL's don't
include enough information that this is possible. You could start disassembling
functions, but it would be too risky.
Posted on 2002-07-30 15:39:44 by f0dder