imp_implementationWithBlock()
In particular,
imp_implementationWithBlock()
takes a block as a parameter, copies it to the heap, and returns a trampoline that allows the block to be used as the implementation — theIMP
— of a method in any Objective-C class (as long as the block’s arguments and the method’s arguments are compatible).
Most code will never need this, but in rare cases it will be incredibly useful. Currently iOS-only, unfortunately.
2 Comments RSS · Twitter
[...] Fuller explains Apple’s implementation of imp_implementationWithBlock() and posted his own PLBlockIMP, which works on Mac OS X 10.6: On Darwin, vm_remap() provides support [...]