Skip to content

Instantly share code, notes, and snippets.

@CodaFi
Created April 7, 2014 00:55
Show Gist options
  • Save CodaFi/10013315 to your computer and use it in GitHub Desktop.
Save CodaFi/10013315 to your computer and use it in GitHub Desktop.
#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