On Fri, Aug 8, 2008 at 2:48 PM, André Pang <[EMAIL PROTECTED]> wrote:

> Hi all, is there a reasonably easy way to programmatically determine
> whether a particular executable on-disk supports garbage collection?  Cocoa
> methods aren't necessary; all C functions are welcome.  Poking around in an
> executable's Mach-O headers is fine too, but I'm not sure what to look for.
>
> My usage scenario is that we're intending to ship an experimental GC
> version of our app to some customers, but we have a lot of plugins for our
> app, and they won't work under the GC version unless they're compiled
> GC-supported.  I'd like to display a sheet in the regular, non-GC version of
> the app that tells the user which plugins aren't GC-supported, so I can't
> simply attempt to preflight the bundle and see if that fails, since the
> preflight check would be running on the non-GC version.  Any hints?
>

You want to look at the __image_info section in the __OBJC segment:

struct objc_image_info  {
  uint32_t version; // initially 0
  uint32_t flags;
};

#define OBJC_IMAGE_SUPPORTS_GC   2
#define OBJC_IMAGE_GC_ONLY       4

Have a look at the linker source code in MachOReaderDylib.hpp. You'll have
to check what needs to be swapped.

I don't know if there's an easier way of figuring it out.

-- Chris
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to