Manually load or bypass a dylib?

Discussion in 'Mac Programming' started by Sydde, Apr 23, 2010.

  1. Sydde macrumors 68020


    Aug 17, 2009
    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.
  2. Catfish_Man macrumors 68030


    Sep 13, 2001
    Portland, OR
  3. kpua macrumors 6502

    Jul 25, 2006
    man dlopen
    Just try loading the dylib yourself, and if it fails, use your compatibility path.

Share This Page