Skip navigation.
 
mlRe: Bundle Loading/Unloading at runtime
FROM : Jean-Daniel Dupas
DATE : Fri Jan 04 17:35:40 2008

Le 4 janv. 08 à 17:19, Rahul Shetty a écrit :

> Hi All,
>
> We are developing an application that has to run on both Tiger and 
> the Leopard.  The application has quite a few Cocoa bundles ,each 
> representing a separate service.
> We have reasons to believe that the services that the bundles 
> support will undergo constant update.  Hence we have a need to 
> update the bundles frequently through  software update.
> We want this update to take effect while the application is running.
>
>
> However in terms of loading and unloading the bundles at run time, 
> we would like to have the following behavior:
>
> 1. We identify the bundle that is not busy and unload it.
> 2. We block all further calls to the bundle
> 3. We download the latest bundle
> 3. We load the new bundle in the place of the old one
> 4. All this happening in the background when the application is 
> running .
> 5. This is repeated for each of the bundle
>
> The bundles contain mostly Objective-C code. We know that a Cocoa 
> loadable bundle cannot be unloaded (the documentation under 
> "CFBundle and NSBundle" talks about it) . This we believe is the 
> crux of the problem.  We tried in vain to
> move the Objective-C code to a carbon bundle and then use the 
> CFBundle calls to load/unload the bundle .


I think you do not understand what Carbon Bundle and Cocoa Bundle means.
There is no differences between Cocoa and Carbon bundles. The term 
"Cocoa Bundle" is generally used for a bundles linked on Cocoa and 
"Carbon Bundle" for bundles linked on Carbon, but they really are the 
same thing.

AFAK, a bundle that uses obj-c cannot be unload (prior to 10.5) 
because the obj-c runtime do not support it. So you cannot use obj-c 
in a bundle that have to be unloaded (and that must support Mac OS 
10.4).


> We create an Cocoa object through a function exported from the 
> bundle and proceed
> to access the services of the other Cocoa classes through this  . 
> We are facing random crashes even in this method. This might be due 
> to the issue of the CFBundle being unable to
> load and register all the Cocoa classes.
>
> The harder option is to rewrite the bundle code in C++ and using 
> CoreFoundation classes. However, we would like to keep this as the 
> last option.
>
> Can you provide us with any inputs into how we could go about 
> solving the issue?
>
> Thank you.
>
> Regards,
> Rahul.
>
>
>

Related mailsAuthorDate
mlBundle Loading/Unloading at runtime Rahul Shetty Jan 4, 17:19
mlRe: Bundle Loading/Unloading at runtime Jean-Daniel Dupas Jan 4, 17:35