OS X 10.6.7 および Qt 4.7.3 で Qt を使用して動的ライブラリを作成しようとしています。考えられる最も基本的なテストを作成しました (以下またはhttps://gist.github.com/1016045を参照) 。
otool -T build/libstackoverflow.dylib
まだ報告している
build/libstackoverflow.dylib:
Table of contents (0 entries)
module index symbol index
そのリストには、階乗に関連する何か他のものが表示されるはずだと思います。
テストケース (こちらもhttps://gist.github.com/1016045 ):
// main.cpp
#include <stdint.h>
#include <QtCore/QtGlobal>
#if defined(MYSHAREDLIB_LIBRARY)
# define MYSHAREDLIB_EXPORT Q_DECL_EXPORT
#else
# define MYSHAREDLIB_EXPORT Q_DECL_IMPORT
#endif
MYSHAREDLIB_EXPORT uint64_t factorial(int max) {
int i = max;
uint64_t result = 1;
while (i >= 2)
result *= i--;
return result;
}
// stackoverflow.pro
TEMPLATE = lib
DEFINES += MYSHAREDLIB_LIBRARY
CONFIG += qt dll
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
DESTDIR = ./build
# Input
SOURCES += main.cpp
ビルドするには:
qmake
make
もう読んだ:
該当する場合は、他のリソースをお勧めします。
編集:
Q_DECL_EXPORT マクロを使用することで回避できるはずだと思っていた名前が破損している (または少なくとも破損しているように見える) ものの、シンボルは正しくエクスポートされている可能性があると思います。たとえば、nm -g build/libstackoverflow.dylib を実行した結果は次のとおりです。
0000000000001f20 T __Z9factoriali
U ___gxx_personality_v0
U dyld_stub_binder
これは私が期待すべきことですか?