From: Allann J. <all...@gm...> - 2012-11-27 20:31:38
|
On Mon, Nov 26, 2012 at 9:54 AM, Earnie Boyd <ea...@us...>wrote: > On Sun, Nov 25, 2012 at 6:12 AM, Philipp Kraus wrote: > > Hello, > > > > I try to build a shared library under MinGW (with g++) for using a JNI > calls. > > I have found this information http://www.mingw.org/node/41 but I can > build the DLL, but the JNI call does not work. > > I get the error "unsatisfied link error". I have checked with procmon, > if all depend DLLs are found, and alls DLLs > > are found, so IMHO the problem is the "native call / function name". > > > > I'm using the JDK 7 and Swig for generating Java classes & C++ codes. > The function names within the DLL are: > > Java_packagename1_packagename2_classnamewithJNIfunction_functionname@ > > > > The define _JNI_IMPLEMENTATION does not change anything, also the > --kill-at on the linker command. I'm using > > g++ 4.7.0 under the MSYS shell. > > > > Can anybody send me a tip to solve the problem. IMHO the JRE does not > find the correct function within my DLL. > Hi. This is a minimal example that is compiling and working on MinGW (updated) at here. Please, modify the paths accordingly. > > Do you create a .def file? You can create a .def file from the gendef > package (see > http://mingw.git.sourceforge.net/git/gitweb.cgi?p=mingw/mingw.org-tools;a=tree > ) > for the source, we're not distributing it yet but it does build. > You'll need autoconf to create the configure script. Or you can > create the .def during the build of the DLL with linker option > "--output-def <FILE>". > > |