Please move this to one of the open-source list, this is not SDK discussion.
On Wed, Feb 4, 2009 at 2:14 PM, jima <jima80...@gmail.com> wrote: > > I've been expanding on the example given here: > > http://davanum.wordpress.com/2007/12/09/android-invoke-jni-based-methods-bridging-cc-and-java/ > (thanks for that example!) > > and have am getting Unresolved symbols when I have a class with a > virtual function. I am using the java code given in the above > example. Here's the C++ code I am using: > > #include "com_hp_CamDemo_Native.h" > > class jj { > virtual int func() {return 0;};// this line causes a failure > // int func() {return 0;};// this line works > }; > > JNIEXPORT jlong JNICALL Java_com_hp_CamDemo_Native_add (JNIEnv * env, > jclass c, jlong a, jlong b) { > > jj *j = new jj; > > return a * b * 4; > } > > There are two function definitions in the class jj. The one with the > virtual keyword (which forces the class to have a vtable) results in > the UnsatisifiedLinkError exception being thrown, while the non- > virtual function works fine. > > Here are the compile and link command lines I am using > arm-none-linux-gnueabi-g++ -MD -c -fpic -I/usr/java/jdk1.6.0_11/ > include/ -I/usr/java/jdk1.6.0_11/include/linux -o obj/jini.o jini.cpp > arm-none-linux-gnueabi-ld -T armelf_linux_eabi.xsc --error-unresolved- > symbols -static -shared -o libNative.so obj/jini.o > > Is there a command line switch I'm missing that will allow this to be > used in android? > > FWIW, I'm building the .so on Fedora Core 8 with the arm-2007q3 > toolset and I'm running the android emulator on windowsXP. > > Thanks for any insight or suggestions on how to find a solution for > this! > jim anderson > > > > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---