My Windows programmer has provided me with jni compatible .c and .h
files which compile just fine on his system. It creates a HiResTimer
dll returning microsecond elapsed times. He wishes me to compile this
into a shared library (called libHiResTimer.jnilib) to place into the
same folder to allow the java byte code to work on both platforms.
(I've used Microseconds() as a first attempt at this).
I've followed the instructions in the XCode documentation on JNI using
gcc and the command line. The calls are:
cc -c -I/System/Library/Frameworks/JavaVM.framework/Headers
com_cogstate_utils_HiResTimer.c
which successfully creates the object file:
com_cogstate_utils_HiResTimer.o
Then:
cc -dynamiclib -o libHiResTimer.jnilib com_cogstate_utils_HiResTimer.o
-framework JavaVM
This fails to link with the following error:
internal link edit command failed
ld: com_cogstate_utils_HiResTimer.o illegal reference to symbol:
_Microseconds defined in indirectly referenced dynamic library
/System/Library/Frameworks/CoreServices.framework/Versions/A/
Frameworks/CarbonCore.framework/Versions/A/CarbonCore
(I've removed the Microseconds function calls and the rest of the code
compiles and works as expected).
So, how do I include the correct extra shared library that contains the
Microseconds()? Any help would be appreciated - including directing me
to a site with this answered. (I apologize if it's trivially simple and
I need to include a lib from somewhere, but I tried without success to
find and include all sorts of libs.)
David Darby
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden