Wrapping SDL in a Library/Framework

I’m working on a project that requires OpenGL, some physics, and basic touch input for iOS and Android. However, this project needs to be compiled as a library so other mobile developers can use it in their own apps.

Has anyone seen SDL used in this way on mobile? we’ve been able do it on Android through other frameworks, but can’t seem to get it to work (or even find an example showing it’s possible) on iOS.

Any advice would be a huge help. Thanks in advance.


Yes, it is possible. I ship prebuilt SDL (and friends) libraries for
multiple platforms for Blurrr (blurrrsdk.com).
The process is a lot like Mac.
Until recently, it was required you could only use static libraries,
not dynamic libraries. Static linking adds some extra hoops to jump
through because all link dependencies are passed on to the final app.
Duplicate symbol problems are another potential issue.

Dynamic libraries became available when Apple introduced their plugin
system. I’m still hesitant to call dynamic libraries official because
of that. They just happen to work as an implementation detail of
making their plugin system work. Their system is built around
.framework bundles and Xcode I think still likes to pretend .dylibs
don’t exist for iOS projects.

Most examples and the iOS ecosystem uses static libraries from
inertia. Ultimately, the procedure is just like building and linking
any .a library on any Unix system.


Thanks, Eric!
I’ll give it a try and see how it goes. Thanks again for the quick response and the few gotchas to watch out for.