Skip to content

Instantly share code, notes, and snippets.

@kyab
Forked from Watson1978/main.m
Created July 4, 2011 17:36
Show Gist options
  • Save kyab/1063666 to your computer and use it in GitHub Desktop.
Save kyab/1063666 to your computer and use it in GitHub Desktop.
$ gcc main.m -framework Foundation -framework MacRuby -fobjc-gc
$ ./a.out
Fixnum
42
#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;
}
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