Created
April 7, 2014 00:55
-
-
Save CodaFi/10013315 to your computer and use it in GitHub Desktop.
A replacement for objc_msgSendv. Requires @jspahrsummers' metamacros https://github.com/jspahrsummers/libextobjc/blob/master/extobjc/metamacros.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Cocoa/Cocoa.h> | |
#include <objc/message.h> | |
#include "metamacros.h" | |
#define CFIEXTRACTARGS(COUNT, ARR) \ | |
, ARR[COUNT] \ | |
#define objc_msgSendv(RECIEVER, SELECTOR, COUNT, ARR) \ | |
objc_msgSend(RECIEVER, SELECTOR \ | |
metamacro_for_cxt(COUNT, CFIEXTRACTARGS,, ARR) \ | |
) \ | |
int main(int argc, const char * argv[]) | |
{ | |
id argList[3] = {@"this is a text %@ %@",@"of this",@"code"}; | |
// Get return value | |
id returnValue = objc_msgSendv(NSString.class, @selector(stringWithFormat:), 3, argList); | |
// Log it | |
NSLog(@"%@", returnValue); | |
return NSApplicationMain(argc, argv); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment