Possible to build a shared library with static link used library?

后端 未结 3 517
傲寒
傲寒 2020-12-29 10:33

I can build a executable with gcc with static link:

gcc -static xxx.c -o xxx

So I can run xxx without any external dependent lib

3条回答
  •  鱼传尺愫
    2020-12-29 11:15

    If you have any plans on portability for your shared library, use libtool(1). It will handle most of the details of compiler flags for you and will make your life infinitely easier. If you don't use libtool, but later decide you want to port your program to OS X or Windows, you're going to end up reinventing it anyway.

提交回复
热议问题