Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Shared library dependency on Android with SFML Activity  (Read 2218 times)

0 Members and 1 Guest are viewing this topic.

victorlevasseur

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Shared library dependency on Android with SFML Activity
« on: April 15, 2016, 02:15:38 pm »
Hi,

My native SFML android app is composed of two shared libraries. The first one is linked to the second one in the Android.mk and the compilation is successful. However, when I launch the app, it crashes and it tells that Android can't find /data/app/com.xxxx.xxx/lib/arm/libMyFirstLib.so. It seems that the errors happens when the the second lib (set in "sfml.app.lib_name" in AndroidManifest.xml) is loaded with dlopen (here : https://github.com/SFML/SFML/blob/master/src/SFML/Main/SFMLActivity.cpp#L113).

So, the question is : do I need to customize the SFML activity (and create my own native activity) to dlopen libMyFirstLib.so manually before loading the second library ?

Thanks.
« Last Edit: April 15, 2016, 02:17:30 pm by victorlevasseur »

DarkRoku12

  • Full Member
  • ***
  • Posts: 203
  • Lua coder.
    • View Profile
    • Email
Re: Shared library dependency on Android with SFML Activity
« Reply #1 on: April 15, 2016, 03:45:59 pm »
You can create a dummy library as the (main) entry point, this dummy will load all your libraries (as SFML does), then when you finish loading all, call another entry point.

But if you want you can add a library for be loaded putting another "loadLibrary" down this line.

Ej:
    // SFML libraries
    loadLibrary("sfml-system", lJNIEnv, ObjectActivityInfo);
    loadLibrary("sfml-window", lJNIEnv, ObjectActivityInfo);
    loadLibrary("sfml-graphics", lJNIEnv, ObjectActivityInfo);
    loadLibrary("sfml-audio", lJNIEnv, ObjectActivityInfo);
    loadLibrary("sfml-network", lJNIEnv, ObjectActivityInfo);
    // Custom libraries
    loadLibrary( "myCustomLibrary" lJNIEnv, ObjectActivityInfo);
 

You'll only need to rebuild sfml-activity if you go with the second method.
« Last Edit: April 15, 2016, 03:48:27 pm by DarkRoku »
I would like a spanish/latin community...
Problems building for Android? Look here

victorlevasseur

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Re: Shared library dependency on Android with SFML Activity
« Reply #2 on: April 15, 2016, 04:42:19 pm »
Thanks, that's two good ideas. I'll look at it soon.  :)

 

anything