summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/g/clib_example/src/clib_example.c
diff options
context:
space:
mode:
authorDaniel Bovensiepen <[email protected]>2012-09-21 19:56:28 +0800
committerDaniel Bovensiepen <[email protected]>2012-09-21 19:56:28 +0800
commitd6f2f55b46ceddd986e7ba42fb8269aef0ca8e77 (patch)
tree9e3a405436789e9c782a6c4c00eafed4301df809 /mrbgems/g/clib_example/src/clib_example.c
parentf93572c531c1e69dc0c5d2c2bfd03fc83044158c (diff)
downloadmruby-d6f2f55b46ceddd986e7ba42fb8269aef0ca8e77.tar.gz
mruby-d6f2f55b46ceddd986e7ba42fb8269aef0ca8e77.zip
Add Support for Ruby Extensions, C Extensions and Test Integration
Diffstat (limited to 'mrbgems/g/clib_example/src/clib_example.c')
-rw-r--r--mrbgems/g/clib_example/src/clib_example.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/mrbgems/g/clib_example/src/clib_example.c b/mrbgems/g/clib_example/src/clib_example.c
new file mode 100644
index 000000000..2ab8682b2
--- /dev/null
+++ b/mrbgems/g/clib_example/src/clib_example.c
@@ -0,0 +1,17 @@
+#include <mruby.h>
+#include <stdio.h>
+
+static struct RClass *_class_clib;
+
+static mrb_value
+mrb_clib_example(mrb_state *mrb, mrb_value self)
+{
+ puts("A C Extension");
+ return self;
+}
+
+void
+mrb_clib_example_gem_init(mrb_state* mrb) {
+ _class_clib = mrb_define_module(mrb, "CLib");
+ mrb_define_class_method(mrb, _class_clib, "clib_method", mrb_clib_example, ARGS_NONE());
+}