Compile shared library into a program?

和自甴很熟 提交于 2019-12-02 08:19:41

Compile it as a static library and link that into the executable.

Though the OP had solved his problem by answering a different question, there are (at least) two ways to wedge a shared library into your binary in case

  • there is no source code available
  • there is no compiler (or build-chain) available
  • static link does not work or it's not obvious how do it
  • to preserve memory layout - static link will change it and may "wake-up" hidden bugs
  • for "permanent link" LD_PRELOAD library into executable

The first is statifier (open source but limited to x86 and x86_64 and only object code)

The second that I know of is magic ermine (by the same developer). It is closed source, but the developer is friendly to opensource projects and ermine has the advantage of supporting more platforms as well as the ability to include all necessary data files within its virtual file system.

http://statifier.sourceforge.net/ and http://www.magicermine.com/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!