Skip to content

Commit fb183e4

Browse files
committed
example C extension
1 parent 3d5da26 commit fb183e4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

ext/example_ext/example_ext.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,18 @@
22

33
VALUE rb_mExampleExt;
44

5+
static VALUE
6+
example_hello(int argc, VALUE *argv)
7+
{
8+
printf("hello\n");
9+
10+
return Qnil;
11+
}
12+
513
void
614
Init_example_ext(void)
715
{
816
rb_mExampleExt = rb_define_module("ExampleExt");
17+
18+
rb_define_module_function(rb_mExampleExt, "hello", example_hello, -1);
919
}

0 commit comments

Comments
 (0)