2010-09-10 43 views
5

我想創建一個將調用Qt的DLL(目前我無法使用Jambi來獲得我需要的功能)。我有一個簡單的Java方法:使用MINGW建立一個JNI DLL

public final native int createChild(int handle); 

我在Visual Studio Express 2010中創建了C項目,並且能夠構建DLL。

然後,我在Qt創建者中創建了一個項目,並將其源移動到那裏。我試圖構建配置到我所知,但我得到的是:

java.lang.UnsatisfiedLinkError: tools.proofofconcept.control.EmbedderComposite.createChild(I)I 

我的猜測是,符號不正確地從DLL導出。我加-D_JNI_IMPLEMENTATION_連接ARG:

g++ -D_JNI_IMPLEMENTATION_ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -shared -mthreads -Wl -Wl,--out-implib,debug\libqt_integration.a -o debug\qt_integration.dll debug/dllmain.o debug/nativecode.o debug/qmfcapp.o debug/qwinwidget.o debug/moc_qwinwidget.o -L"c:\Qt\2010.05-rc1\qt\lib" -lQtGuid4 -lQtCored4 

回答

6

我早該以下論點說:

-Wl,--kill-at 

它會改變輸出的符號格式。

2

如果您使用的是Qt,請確定使用了哪個配置。默認使用「默認」配置(文件夾「mkspecs/default」),對於win32,這會導致「UnsatisfiedLinkError」。