Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Compiling a .dll in netbeans (Almost there)

843829Sep 16 2008 — edited Aug 16 2010
(I have the GNU g++ cygwin compile installed and selected to be used as C compiler in netbeans)

I have got so far but falling at the last hurdle.

I have modified a java wrapper so that I can put it in a package, I adjusted the code, compiled it, called javah on the source class using:

javah packagename.classname

which worked

I've then re-written the wrapper.c file so that it includes this new header file classname.h
I've re-written the methods so that they start with Java_packagename1_classname1_ (the way they appear in the header)

I've created a new C/C++ project in netbeans (Selected dynamic linked library in options)

I've added the exsisting classname.h files + Cdll.h file to the header files (both included in the wrapper.c)

Now I should be set to compile my wrapper.c into a .dll file

I press the build button and I get this:
Running "C:\cygwin\bin\make.exe  -f Makefile CONF=Debug" in C:\Documents and Settings\test\DynamicLibrary_3

/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-conf
make[1]: Entering directory `/cygdrive/c/Documents and Settings/test/DynamicLibrary_3'
mkdir -p build/Debug/Cygwin-Windows/_ext/C_/Documents_and_Settings/test/DynamicLibrary_3/../My_Documents/Java_Projects/USB_K8055/build/classes
gcc.exe    -c -g -IC\:/Program\ Files/Java/jdk1.6.0_01/include -IC\:/Program\ Files/Java/jdk1.6.0_01/include/win32 -fPIC  -o build/Debug/Cygwin-Windows/_ext/C_/Documents_and_Settings/test/DynamicLibrary_3/../My_Documents/Java_Projects/USB_K8055/build/classes/J-k8055-wrapper.o ../My\ Documents/Java\ Projects/USB_K8055/build/classes/J-k8055-wrapper.c
../My Documents/Java Projects/USB_K8055/build/classes/J-k8055-wrapper.c:1: warning: -fPIC ignored for target (all code is position independent)
../My Documents/Java Projects/USB_K8055/build/classes/J-k8055-wrapper.c:18:41: USB_interface_usb_interface.h: No such file or directory
../My Documents/Java Projects/USB_K8055/build/classes/J-k8055-wrapper.c:19:22: K8055D_C.h: No such file or directory
../My Documents/Java Projects/USB_K8055/build/classes/J-k8055-wrapper.c: In function `Java_USB_1interface_usb_1interface_JReadAllAnalog':
../My Documents/Java Projects/USB_K8055/build/classes/J-k8055-wrapper.c:97: error: request for member `NewLongArray' in something not a structure or union
../My Documents/Java Projects/USB_K8055/build/classes/J-k8055-wrapper.c:98: error: request for member `GetLongArrayElements' in something not a structure or union
../My Documents/Java Projects/USB_K8055/build/classes/J-k8055-wrapper.c:117: error: request for member `ReleaseLongArrayElements' in something not a structure or union
../My Documents/Java Projects/USB_K8055/build/classes/J-k8055-wrapper.c: In function `Java_USB_1interface_usb_1interface_JReadDigitalChannel':
../My Documents/Java Projects/USB_K8055/build/classes/J-k8055-wrapper.c:210: error: `false' undeclared (first use in this function)
../My Documents/Java Projects/USB_K8055/build/classes/J-k8055-wrapper.c:210: error: (Each undeclared identifier is reported only once
../My Documents/Java Projects/USB_K8055/build/classes/J-k8055-wrapper.c:210: error: for each function it appears in.)
../My Documents/Java Projects/USB_K8055/build/classes/J-k8055-wrapper.c: In function `Java_USB_1interface_usb_1interface_JSetCurrentDevice':
../My Documents/Java Projects/USB_K8055/build/classes/J-k8055-wrapper.c:319: error: parameter name omitted
../My Documents/Java Projects/USB_K8055/build/classes/J-k8055-wrapper.c:319: error: parameter name omitted
make[1]: *** [build/Debug/Cygwin-Windows/_ext/C_/Documents_and_Settings/test/DynamicLibrary_3/../My_Documents/Java_Projects/USB_K8055/build/classes/J-k8055-wrapper.o] Error 1
make[1]: Leaving directory `/cygdrive/c/Documents and Settings/test/DynamicLibrary_3'
make: *** [.build-impl] Error 2

Build failed. Exit value 2.
Any ideas ?

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 13 2010
Added on Sep 16 2008
13 comments
1,659 views