Created
March 24, 2012 05:07
-
-
Save Watson1978/2178472 to your computer and use it in GitHub Desktop.
MacRuby : ticket #1485
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
require "mkmf" | |
$CFLAGS << ' -fobjc-gc -std=c99 ' | |
create_makefile("Foo") |
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 <Foundation/Foundation.h> | |
#include <stdarg.h> | |
@interface Foo : NSObject { | |
} | |
/// this method would print the variables. | |
- (void) log: (id) firstObj, ... NS_REQUIRES_NIL_TERMINATION; // Obj-C variadic method. Using nil at the end of args. | |
@end |
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
#include "foo.h" | |
@implementation Foo | |
- (void) log: (id) firstObj, ... { | |
va_list ap; | |
va_start (ap, firstObj); | |
for (id obj = firstObj; obj != nil; obj = va_arg(ap, id) ){ | |
NSLog(@"%@", obj); | |
} | |
va_end (ap); | |
} | |
@end | |
// For MacRuby | |
void Init_Foo() {} |
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
require 'Foo' | |
load_bridge_support_file 'Foo.bridgesupport' | |
Foo.new.log ("1", "2", "3", nil) |
Author
Watson1978
commented
Mar 24, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment