开发者

Why can't you combine a DLL with an EXE, as if it had been statically linked?

开发者 https://www.devze.com 2023-03-10 21:20 出处:网络
Why isn\'t it possible* to \"re-link\" a native shared library (DLL) i开发者_Go百科nto an executable file, as if they had been statically linked? Is the DLL missing any required information?

Why isn't it possible* to "re-link" a native shared library (DLL) i开发者_Go百科nto an executable file, as if they had been statically linked? Is the DLL missing any required information?

*Note: Or is it actually posible? If it is, please let me know, but through searches I've come to the conclustion that it's not possible.


It isn't directly possible.

When an EXE loads a DLL (via LoadLibrary) there's a lot of work done by the DLL loader to patch adresses. You can't just combine a DLL as is with an exe, because its adresses are wrong if it's not dynamically loaded.

On the other hand, a LIB is statically linked: no loading involved, no adress fixing, everything works without further job when you launch the program.

What is possible to do is to convert a DLL and EXE back to OBJ and link them together statically.

0

精彩评论

暂无评论...
验证码 换一张
取 消