How do I get a bundle reference from inside of a plugin with carbon?

Posted by Nik Reiman on Stack Overflow See other posts from Stack Overflow or by Nik Reiman
Published on 2010-03-26T12:16:39Z Indexed on 2010/03/26 13:13 UTC
Read the original article Hit count: 343

Filed under:
|
|
|
|

I'm writing a C++ plugin in Mac OS X using the Carbon framework (yeah, yeah, I know, Apple is deprecating Carbon, but at the moment I can't migrate this code to Cocoa). My plugin gets loaded by a master application, and I need to get a CFBundleRef reference to my plugin so that I can access it's resources.

The problem is, when I call CFBundleGetMainBundle() during my plugin's initialization routines, that returns a reference to the host's bundle reference, not the plugin's. How can I get a reference to my plugin's bundle instead?

Note: I would rather not use anything determined at compile-time, including calling CFBundleGetBundleWithIdentifier() with a hard-coded string identifier.

© Stack Overflow or respective owner

Related posts about mac

Related posts about carbon