Re: Migrating shared library plugins to Cocoa Touch Frameworks
Re: Migrating shared library plugins to Cocoa Touch Frameworks
- Subject: Re: Migrating shared library plugins to Cocoa Touch Frameworks
- From: Andreas Falkenhahn <email@hidden>
- Date: Sat, 03 Dec 2016 12:00:15 +0100
On 03.12.2016 at 00:40 Jens Alfke wrote:
> dlopen is hardly undocumented; it’s part of the core BSD Unix
> library. It’s got a man page and everything.
That doesn't mean that it's ok to use it on iOS because of the sandbox.
You aren't allowed to use other standard BSD functions like exit(),
mkstemp(), exec(), system(), etc. on iOS either because of the sandbox.
> Prior to iOS 8, the sandbox that 3rd party iOS apps ran in blocked
> calls to dlopen, as well as other attempts to load dynamic libraries
> from within the app bundle. That is now no longer the case, so you
> can use dlopen
Once again, that is your opinion unless there is any document from
Apple explicitly stating that it's allowed. The fact that it works
doesn't count :)
I don't want to sound overly pedantic here and I really believe you
guys that probably it's really allowed to use dlopen() starting with
iOS 8 and everything is fine. All I'm trying to stress here is that
basically when using dlopen() we are relying on undocumented behaviour
and there is no guarantee that what we're doing is really officially
supported.
> That’s sort of weird; however, a framework is just a dynamic
> library packaged with its headers in a specific bundle format. You
> can always use a framework target and then add a script build step
> to copy the library out of the framework.
Once again, that's relying on undocumented behaviour. It's obvious
that a framework is just a bundle containing a dylib but nobody
can say whether manually dlopen()ing this dylib is something that is
allowed on iOS. Maybe future versions of iOS will block manual dlopen()
access to the dylib inside the framework and will only allow the
system dylib loader to open it. Who knows.
> I think the lack of a dylib target may just reflect that plug-ins
> of the kind you’re implementing aren’t really very useful on iOS.
> Since there’s no way to install extra plugins (downloading
> executable code is explicitly forbidden), the set of plugins is
> effectively fixed, meaning it would be more efficient to just
> statically link them all into the app.
What about NSDocumentDirectory? Users could copy additional plugins
as frameworks into the app's documents directory using iTunes. Will
dlopen()ing such dylibs work as well? Or does it only work when the
binaries are stored in the main bundle container?
--
Best regards,
Andreas Falkenhahn mailto:email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden