2

多くの共有ライブラリと静的ライブラリに内部的にリンクしている共有ライブラリを作成しようとしています。私の場合、私の共有ライブラリには static lib が含まれていません。それが正しいかどうか、または静的ライブラリを共有ライブラリに変換してからリンクを行う必要があるかどうかを知りたいです。

共有 lib とともに静的ライブラリを追加できるようにする makefile フラグがあることを知る必要があります。

提案してください 。

4

1 に答える 1

0

他のライブラリ (静的および動的) に依存するライブラリを作成できます。ただし、静的ライブラリ部分を内部に統合する必要があります(これは動的にロードできないため)

dependence of your source code:
your_library -> static_library.lib
your_library -> dynamic_library.dll

how you implement can it (to be used by an executable):

your_library.dll (which contain your_library and static_library source code)
dynamic_library.dll (to distribute with your_library.dll)

or

your_library.dll
static_library.dll (to be created from the static_library.lib)
dynamic_library.dll (to distribute with your_library.dll)

編集:ここであなたが探しているものが静的ライブラリを共有ライブラリに変換するかもしれません(これはLinux用ですが、OSでも同じです):

.a files are just archives of .o object files, so all you need to do is unpack the archive and repackage them as a shared object (.so)
ar -x mylib.a
gcc -shared *.o -o mylib.so
于 2010-01-25T11:49:33.303 に答える