Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 5148a8f383
Fetching contributors…

Cannot retrieve contributors at this time

43 lines (31 sloc) 0.813 kB
#import <Foundation/Foundation.h>
#if TARGET_OS_IPHONE && TARGET_OS_EMBEDDED
#define USE_CUSTOM_LIBFFI 1
#endif
#if USE_CUSTOM_LIBFFI
#import <ffi.h>
#define USE_LIBFFI_CLOSURE_ALLOC 1
#else // use system libffi
#import <ffi/ffi.h>
#endif
@interface MABlockClosure : NSObject
{
NSMutableArray *_allocations;
ffi_cif _closureCIF;
ffi_cif _innerCIF;
int _closureArgCount;
ffi_closure *_closure;
void *_closureFptr;
id _block;
}
- (id)initWithBlock: (id)block;
- (void *)fptr;
@end
// convenience function, returns a function pointer
// whose lifetime is tied to 'block'
// block MUST BE a heap block (pre-copied)
// or a global block
void *BlockFptr(id block);
// copies/autoreleases the block, then returns
// function pointer associated to it
void *BlockFptrAuto(id block);
Jump to Line
Something went wrong with that request. Please try again.