Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert a dynamic dll to static lib?

I write a program helloworld.exe; it depends on a.dll. I don't have the source code of the a.dll, which is a dynamic dll. How can i change it to static library, so I can link it into helloworld.exe?

like image 615
xufan Avatar asked Apr 05 '10 04:04

xufan


2 Answers

Sorry, but there's no direct way to do so. A DLL is a fully linked executable format file, where a static library is a collection of separate object files collected together. With a little bit of work, you can convert a static library to a DLL, but doing the reverse is non-trivial (to put it mildly).

like image 165
Jerry Coffin Avatar answered Sep 18 '22 15:09

Jerry Coffin


As Jerry said, you cannot do it directly. You can, however, package your program into something like a self extracting RAR file which includes the DLL as part of the single EXE, which automatically extracts the EXE and associated DLLs to a temp folder and starts the main program.

like image 45
Billy ONeal Avatar answered Sep 17 '22 15:09

Billy ONeal