Shared object support

Jules,

One thing I’d love to see is project/make support in Introjucer (IJ) for shared objects (*.so). Let me explain the the bits and pieces of how I do this today, and perhaps you would consider making it automated. Let’s say you have a shared library libfoo.so.

  1. Android.mk will need a link switch for this -lfoo in this case. IJ already does this today if you simply list the object in the “external libraries” list.

  2. Again in Android.mk, you need a pre-built declaration for each shared lib (so that they get included in the APK libs/). It looks like this:

     [code]
     include $(CLEAR_VARS)
     LOCAL_MODULE:=foo
     LOCAL_SRC_FILES={path to shared lib}/libfoo.so
     include $(PREBUILT_SHARED_LIBRARY)[/code]
    

The trick here is specifying the path to the *.so - perhaps IJ’s “extra library search paths” could be used somehow.

  1. Finally in the /src Activity java file that IJ creates, add a System.loadLibrary for libFoo.so. Add it before the loadLibrary for juce_jni. Extending this to multiple *so’s, add these calls in the order they are declared in IJ.

These are the steps I do today to update my Android Juce project to use a shared obj.

thanks
jeff

Thanks!

Hmm, the path is the tricky bit. I guess the only way to do it would be for the IJ to require a full path for each library rather than the normal abbreviated name, and to generate what it needs from that?

I know this sounds kludgy, but I suppose you could require that *.so’s be specified with their path in the “External libraries to link” list (and support relative paths if possible). Strip off the path for you link switches and LoadLibrary additions, and use it for the prebuilt declarations blocks in the make.

Yes, that’s what I meant. That’d probably work…