Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
341 views
in Technique[技术] by (71.8m points)

java - Build a JNI DLL using MINGW

I am trying to create a DLL that will call Qt (currently I can't use Jambi for the functionality I need). I have a simple Java method:

public final native int createChild(int handle);

I created C project in Visual Studio Express 2010 and was able to build the DLL.

Then I created a project in Qt creator and moved my sources there. I tried to configure the build to a best of my knowledge but all I get is:

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

My guess is that symbol is not properly exported from DLL. I added -D_JNI_IMPLEMENTATION_ linker arg:

g++ -D_JNI_IMPLEMENTATION_  -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -shared -mthreads -Wl -Wl,--out-implib,debuglibqt_integration.a -o debugqt_integration.dll debug/dllmain.o debug/nativecode.o debug/qmfcapp.o debug/qwinwidget.o debug/moc_qwinwidget.o  -L"c:Qt2010.05-rc1qtlib" -lQtGuid4 -lQtCored4 
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I should've added following argument:

-Wl,--kill-at

It will change exported symbols format.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...