<div>One thing I've encountered: If I'm not mistaken, people can/will use bundled libraries to bundle Qt libraries along with their application (to bypass Ministro.) Others will use bundled libs of their own for other purposes. We will want to load the Qt bundled libs inside the child class loader, so our JAR can talk to them, and the other bundled libs inside the main Java class loader, in case they want to interact with those native bundled libs via JNI. This will require us to make a new distinction on the type of bundled library.</div>
<div><br></div>Other thoughts: I've been looking and it looks like this isn't a difficult change to make. It's very minimal in the way it changes how things are done right now. It does require a change to the JAR files to accomodate for that back-and-forth lib loading that I described. Anyway, I plan to implement all this tomorrow and see how it goes.<div>
<br><div class="gmail_quote">On Thu, Dec 22, 2011 at 8:51 PM, Tyler Mandry <span dir="ltr"><<a href="mailto:tmandry@gmail.com">tmandry@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi all, and Merry Christmas.<div><br></div><div>We were discussing the importance of allowing Java and C++ to interact for many people's apps in android-qt (thread: C++ and Java interaction in Alpha3.) With the new separation of the JAR files, and use of a different class loader for the app code, it has become very difficult to allow this. Traditional native interface classes can no longer see the native methods that are loaded by the separate class loader.</div>
<div><br></div><div>I did some playing around, and I think I found a simple solution that works. If we separate out the code in qtmain_android.cpp into its own (very small!) shared library, and allow the user's application code to be in one library all by itself, we can load them in separate class loaders. While you can't do Java-Java or Java-native interaction easily across the class loader barrier, native-native interaction works fine since it's all the same process. Simply load the Qt library in the /child/ class loader, followed by the application code library in the /main/ class loader, followed by the qtmain_android code in the /child/ class loader. Then the user's Java code can see the user's C++ code and vice versa, because they are all loaded under the same class loader.</div>
<div><br></div><div>I did a testcase of this (with libraries of my own, not Qt) and confirmed that it works in a simple case. If no one sees any problems with this let's implement it.</div><span class="HOEnZb"><font color="#888888"><div>
<div><br></div>-- <br>Tyler Mandry<br>
</div>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>Tyler Mandry<br>
</div>