#endif
#ifdef __APPLE__
+static Class __NSMallocBlock__;
static Class NSCFBoolean_;
static Class NSCFType_;
static Class NSGenericDeallocHandler_;
}
NSObject *CYMakeBlock(JSContextRef context, JSObjectRef function, sig::Signature &signature) {
+ _assert(__NSMallocBlock__ != Nil);
BlockLiteral *literal(reinterpret_cast<BlockLiteral *>(malloc(sizeof(BlockLiteral))));
CYBlockDescriptor *descriptor(new CYBlockDescriptor);
descriptor->internal_ = CYMakeFunctor_(context, function, signature, &BlockClosure_);
literal->invoke = reinterpret_cast<void (*)(void *, ...)>(descriptor->internal_->GetValue());
- literal->isa = objc_getClass("__NSMallocBlock__");
+ literal->isa = __NSMallocBlock__;
literal->flags = BLOCK_HAS_SIGNATURE | BLOCK_HAS_COPY_DISPOSE | BLOCK_IS_GLOBAL;
literal->reserved = 0;
literal->descriptor = descriptor;
Object_ = objc_getClass("Object");
#ifdef __APPLE__
+ __NSMallocBlock__ = objc_getClass("__NSMallocBlock__");
+
// XXX: apparently, iOS now has both of these
NSCFBoolean_ = objc_getClass("__NSCFBoolean");
if (NSCFBoolean_ == nil)