更新:經過一些閱讀後,我發現這個問題是完全一般的,你不能在同一個進程中混合架構,所以64位Java不能像dlopen()
這樣的32位庫像FMOD。是否有任何可能的解決方法,請記住我正在爲FMOD庫編寫我自己的C接口?製作64位共享庫,動態鏈接到Mac OS X上的32位庫雪豹
我需要在Max OS X上創建64位dylib,因爲Java本機訪問只喜歡64位機器上的64位庫。問題是,我的C源代碼動態地包含了FMOD,它在Mac上只提供32位dylib。當我嘗試沒有-m32選項編譯(因爲我必須輸出64位dylib)我得到以下錯誤:
gcc -dynamiclib -std=c99 -pedantic -Wall -O3 -fPIC -pthread -o ../bin/libpenntotalrecall_fmod.dylib ../../src/libpenntotalrecall_fmod.c -lfmodex -L../../lib/osx/
ld: warning: in /usr/lib/libfmodex.dylib, missing required architecture x86_64 in file
Undefined symbols:
"_FMOD_System_CreateSound", referenced from:
_startPlayback in ccJnlwrd.o
"_FMOD_Channel_GetPosition", referenced from:
_streamPosition in ccJnlwrd.o
"_FMOD_System_Create", referenced from:
_startPlayback in ccJnlwrd.o
"_FMOD_System_PlaySound", referenced from:
_startPlayback in ccJnlwrd.o
"_FMOD_Sound_Release", referenced from:
_stopPlayback in ccJnlwrd.o
"_FMOD_Channel_IsPlaying", referenced from:
_playbackInProgress in ccJnlwrd.o
"_FMOD_System_Update", referenced from:
_streamPosition in ccJnlwrd.o
_startPlayback in ccJnlwrd.o
"_FMOD_Channel_SetPaused", referenced from:
_startPlayback in ccJnlwrd.o
"_FMOD_System_Release", referenced from:
_stopPlayback in ccJnlwrd.o
"_FMOD_System_Init", referenced from:
_startPlayback in ccJnlwrd.o
"_FMOD_Channel_SetVolume", referenced from:
_startPlayback in ccJnlwrd.o
"_FMOD_System_Close", referenced from:
_stopPlayback in ccJnlwrd.o
"_FMOD_Channel_SetCallback", referenced from:
_startPlayback in ccJnlwrd.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [all] Error 1
是不是應該可以從我的源代碼得到一個64位的dylib動態地包含32位庫?