On Mac OS X using Objective-C 2, plugin bundles can be compiled with one of three garbage collection settings:
-fobjc-gc
)-fobjc-gc-only
)How can one programmatically query a compiled plugin bundle to determine which of these three settings was used?
It's part of the __OBJC segment but I don't know of any API that exposes it.
Garbage collected:
cristi:tmp diciu$ otool -v -o ./a.out
./a.out:
Contents of (__DATA,__objc_classrefs) section
00000001000010b0 0x0
Contents of (__DATA,__objc_imageinfo) section
version 0
flags 0x6 OBJC_IMAGE_SUPPORTS_GC
Non garbage collected:
cristi:tmp diciu$ otool -v -o ./a.out
./a.out:
Contents of (__DATA,__objc_classrefs) section
00000001000010b0 0x0
Contents of (__DATA,__objc_imageinfo) section
version 0
flags 0x0
The runtime does this using private functions: see gc_enforcer and it's use of * _objcInfoRequiresGC*
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With