Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Sydde

macrumors 68030
Original poster
Aug 17, 2009
2,571
7,068
IOKWARDI
I want to use a dylib if it is there (xarlib - I want 10.4 compatibility) or revert to normal storage (regular Cocoa archiving) if it is not. But my code would be linked to the dylib, so its absence would give me a fatal launch error. Is there a way to catch the exception in main{} or does the launcher fail before even entering main{}? Is there a way to define an exception catcher?

I understand that I could write a framework that I could load manually based on the presence of the dylib, but if there is a more compact way of catching the launch exception, I would prefer to do that.
 
Code:
man dlopen

Just try loading the dylib yourself, and if it fails, use your compatibility path.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.