Bundle loading hooks?

  • Hi,

    I'm one of the authors of PyObjC, which is a Python extension module
    that allows you to write Cocoa classes in Objective-C. This works
    pretty well for normal code, but we ran into a problem w.r.t. dynamicly
    loaded bundles (plugins) and the NSBundle methods 'classNamed:' and
    'bundleForClass:'.

    When you define a subclass of an Objective-C class in Python, the
    PyObjC module automaticly creates a Objective-C class for you and
    registers that with the runtime. That is, it creates the right C
    datastructures and tells the runtime about these using objc_addClass
    and the like. As mentioned before, this works just fine, these classes
    can be used in NIB files and the classes are found using
    NSClassFromString.

    However, if you start querying with the NSBundle +bundleForClass:, all
    classes defined in Python seem to be defined in the main bundle even if
    they are actually defined in another (plug-in) bundle. Simularly,
    NSBundle -classNamed: will only find the class if you use the
    mainBundle. This is a problem for us, because this means Interface
    Builder cannot find the classes in a palette that has been defined in
    Python.

    Does anyone know a documented way to get the administration right? I
    got the IB palette working with a dirty hack: when the python plugin it
    loaded it looks for the NSBundle that is associated with its bundle and
    changes the 'isa' pointer of that NSBundle instance to a subclass of
    NSBundle that overrides classNamed. That doesn't look like the proper
    solution to me :-)

    Ronald
    _______________________________________________
    cocoa-dev mailing list | <cocoa-dev...>
    Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
    Do not post admin requests to the list. They will be ignored.
previous month august 2003 next month
MTWTFSS
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Go to today