I want to port a program I wrote to android. The program is in c++ on windows and linux. The program uses dll's for a plugin architecture. New plugins can be added to the program by downloading a dll which the program loads from a specific folder. My question is... Is it possible to download dlls built for android to a directory on the sdcard then from native code load and use those dll's
+2
A:
Hi,
I think not, external storage is mounted with option noexec. You can load libraries from app's private directory.
ognian
2010-07-03 07:17:48
By private directory do you mean assets and raw folders? if so I thought those were packaged with the apk. can they be downloaded to from net after install or do you have to issue a program update?..
roguetreasure
2010-07-03 07:32:23
No, I meant you should put the .so files in the directory returned from getFilesDir() method I gave you a link for. That must happen at runtime, it can be from internet or assets and raw directories
ognian
2010-07-03 07:58:21
Thanks.. appreciate the answer
roguetreasure
2010-07-04 00:36:29
Technically, you can load code off the sdcard into exectuable memory, it's just that mmap will refuse to map an executable page from a noexec filesystem, so bionic's linker, which uses mmap, will refuse to do it for you - so you'd have to write your own linker which loads to anonymous mapped executable pages. Which would be a lot of work, and mean all the code you load is using real physical memory instead of virtual memory until actually needed.
Chris Stratton
2010-09-26 04:39:15