-
-
Save kyab/1063666 to your computer and use it in GitHub Desktop.
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
$ gcc main.m -framework Foundation -framework MacRuby -fobjc-gc | |
$ ./a.out | |
Fixnum | |
42 |
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> | |
#import <MacRuby/MacRuby.h> | |
int main(void) { | |
id ruby; | |
ruby = [[MacRuby sharedRuntime] evaluateFileAtPath:@"test.rb"]; | |
NSNumber *num = [NSNumber numberWithInt: 42]; | |
[ruby performRubySelector:@selector(main:) withArguments: (id)num, NULL]; | |
return 0; | |
} |
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
def main(num) | |
p num.class | |
puts num | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment