gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

OffTopic > Loading bundles in Cocoa, Objective-C, Mac OS X 10.2

#5551 - Touchstone - Thu May 01, 2003 2:02 pm

A question for all the Mac OS X programmers out there who use Objective-C and Cocoa.

I'm trying to dynamically load additional code for my app but for some reason the host app just terminates when I do the load. The code look like this:
Code:
NSBundle* bundle = [[NSBundle alloc] initWithPath:fullBundlePath];
if (bundle != nil) [bundle load];


Now, my application will simply terminate on [bundle load]. No error messages or anything. I don't get any errors when building either the host app or the plugin.

For another ten points, and this is really tricky. I've accidentally written a plugin that load correctly and behave just like expected. If I load the working plugin before I load any broken plugin the [bundle load] on the broken plugin seems to work fine but the plugin doesn't behave as expected. If I don't load the working plugin, just trying to load a broken plugin, the host app will terminate on [bundle load]. I have a singleton class in the host app and my accidentally working plugin can retreive the singleton class instance just fine but the broken plugins will create a new instance of the class.

Needless to say I've compared the working project settings with the broken project settings and they seem identical. I used FileMerge to compare the WorkingPlugin.pbproj/project.pbxproj with the BrokenPlugin.pbproj/project.pbxproj and the only difference between them was the name if the sourcefiles and target.

I have also made sure that the host application, the plugin framework and the actual plugin are supporting weak linking.

So if anyone know what might cause [bundle load] to fail I'd really like to know.

Thanks.


UPDATE: No matter, problem solved.
_________________
You can't beat our meat