I've been having a problem getting SDL2 working on OSX, both with the 32bit shared library and 64bit shared library.
When I call any SDL2 function, in this example SDL_Init, I get a terminal error with the message dumped on the console:
Illegal Instruction: 4
In my program I am using dlopen() to load the SDL2 shared library which is in the same folder as my application. I then use dlsym() to load all the SDL2 functions. Finally I proceed a point where I call SDL_Init(). It's at that point my program exists with the message above left in the terminal.
I have been dynamically loading SDL2 on Windows, Linux, and Pi without any problems. Is there some special consideration I'm not aware of that are needed when attempting to load SDL2 this way on OSX? Perhaps linking frameworks?
I am on OSX Sierra if that helps.