Created
October 18, 2011 10:55
-
-
Save mikebaldry/1295157 to your computer and use it in GitHub Desktop.
Ruby ext
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' | |
HEADER_DIRS = ["/opt/local/include"] | |
LIB_DIRS = ["/opt/local/lib"] | |
create_makefile("webkitrb") |
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 <ruby.h> | |
static VALUE t_test(VALUE self, VALUE obj) | |
{ | |
return self; | |
} | |
VALUE cMyClass; | |
void Init_MyClass() { | |
cMyClass = rb_define_class("MyClass", rb_cObject); | |
rb_define_method(cMyClass, "test", t_test, 1); | |
} |
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
g++ -I. -I/Users/clockwize/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/i686-darwin10.8.0 -I/Users/clockwize/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/i686-darwin10.8.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -arch x86_64 -g -Os -pipe -no-cpp-precomp -fno-common -pipe -fno-common -c MyClass.cpp | |
MyClass.cpp: In function ‘void Init_MyClass()’: | |
MyClass.cpp:11: error: invalid conversion from ‘VALUE (*)(VALUE, VALUE)’ to ‘VALUE (*)(...)’ | |
MyClass.cpp:11: error: initializing argument 3 of ‘void rb_define_method(VALUE, const char*, VALUE (*)(...), int)’ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment