08-27-2008 08:00 AM
Hi ,
I'm trying to talk to the agilent 6645A with java.
Yes i used jni, creating the .c wrapper and .h works fine.
But i can't find how to link my dll with the gpib-32.dll using gcc.
Is there an option to link in gcc with the gpib-32.obj ?
gcc -c -I"C:\Program Files\Java\jdk1.6.0_07\include" -I"C:\Program Files\Java\jdk1.6.0_07\include\win32" -o gpib-32-java-.dll gpib-32-java.o gpib-32.obj
this one creates the dll but i keep getting the error : unsatisfied link error.
I also created my own .def file , then using dlltool to create .lib, but then i keep getting the error :
undefined reference to `ibdev@24'
<!-- Compile the C code -->
<target name ="cc-JNIcompileC" depends="JNIheaders,JNIlib,jni_lib">
<mkdir dir="built/JNI"/>
<cc link="shared" outtype="shared" objdir="built/JNI" outfile="built/JNI/gpib-32-java.dll">
<compiler name="gcc">
<includepath location ="extern"/>
<includepath location ="built/JNI"/>
<includepath location ="${env.JAVA_HOME}/include"/>
<includepath location ="${env.JAVA_HOME}/include/win32"/>
<fileset dir="source/JNI" includes="gpib-32-java.c"/>
</compiler>
<linker name="gcc">
<libset dir="built/JNI" libs="gpib-32"/>
<linkerarg value="--kill-at"/>
<linkerarg value="-ogpib-32-java.dll"/>
</linker>
</cc>
</target>
This was the build file for it using ant
Anybody allready passed the linking step ? ( google doesn't help to , i searched for every thread about jni java gpib-32)
thx
08-28-2008 03:26 AM
Hello,
As you wrote that you successfully implemented the wrapper using the JNI, I suppose you already found this Knowledge Base?
Unfortunately I cannot provide you with a ready to run solution, but maybe this article, which I found using Google, could help you.
And maybe the JPIB project can help you too.
08-28-2008 03:45 AM
Hi,
thx for the reply 🙂
Yes i found those links, thx anyway.
http://jpib.sourceforge.net/ --> I have not found this one. But is seems very interesting . thx
I foud a way to convert the .obj file to a lib file. And it works !
So for everyone who wants to use gcc, try this 🙂
lib -out:testlib.lib testlib.obj
grts