two-level namespaces and the javabridge
two-level namespaces and the javabridge
- Subject: two-level namespaces and the javabridge
- From: Eric Blenkush <email@hidden>
- Date: Thu, 12 Sep 2002 15:56:59 -0700
Hi,
On 10.1 I was using the -force_flat_namespace linker option in my
project. With 10.2 this is causing a multiply defined symbol error so I
am trying to get things to work without the -force_flat_namespace flag.
According to the docs at
/Developer/Documentation/ReleaseNotes/TwoLevelNamespaces.html this
should solve my problem but without the -force_flat_namespace flag the
javabridge no longer works for me.
My app calls some Java code from Obj-c and that works fine. But within
that Java code it trys to call some Obj-c and an exception is thrown:
java.lang.UnsatisfiedLinkError: dictionaryFromPathforResourceOfType
at com.abc.qilan.CSPlugin.dictionaryFromPathforResourceOfType(Native
Method)
at com.abc.jdbc.CSJDBCAdaptorParams.<init>(CSJDBCAdaptorParams.java:41)
at
com.abc.jdbc.CSJDBCAdaptorParams.adaptorParametersFor(CSJDBCAdaptorParam
s.java:92)
at com.abc.jdbc.CSJDBCAdaptor.adaptorWithName(CSJDBCAdaptor.java:58)
at com.abc.jdbc.CSJDBCBridge.adaptorWithName(CSJDBCBridge.java:38)
An UnsatisfiedLinkError is when java cant find a native method, in this
case obj-c code.
When debugging this using JDB I see some paths to files in the
executing java code:
/usr/lib/java/libObjCJava.A.dylib
/usr/lib/java/libAppKitJava.B.dylib
/usr/lib/java/libFoundationJava.B.dylib
And this is the stack when I see this:
0: java.lang.ClassLoader.findNative() line 1433
1: com.abc.qilan.CSPlugin.dictionaryFromPathforResourceOfType()
line -1
2: com.abc.jdbc.CSJDBCAdaptorParams.<init>() line 41
3: com.abc.jdbc.CSJDBCAdaptorParams.adaptorParametersFor() line 92
4: com.abc.jdbc.CSJDBCAdaptor.adaptorWithName() line 58
5: com.abc.jdbc.CSJDBCBridge.adaptorWithName() line 38
The classLoader seems to look for the obj-c method that I am trying to
call in these libraries. We use a makefile to generate the java bridge
code. Here is the relevant line in the makefile:
$(BRIDGET) -o $(TEMP_DIR) -J../CSJDBC -jni -I$(SRCROOT)/../CSPlugin
-noload -java -init -stub \
$(SRCROOT)/../CSJDBC/CSPlugin.jobs
Again, if I put back the -force_flat_namespace option the javabridge
works! Does anyone have any idea what I need to do to get this working?
Please help!
Thanks,
Eric Blenkush
Here is the multiple definitions of symbol error for reference:
dyld:
/Users/me/Work/qa_cvs/Qa2.7b5.165/Qa/Qa/build/Qa.app/Contents/MacOS/Qa
multiple definitions of symbol _JNI_OnLoad
/System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Libraries/
libjava.jnilib(java.o) definition of _JNI_OnLoad
/System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Libraries/
libnet.jnilib(net.o) definition of _JNI_OnLoad
Qa (Application) has exited due to signal 5 (SIGTRAP).
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.