summaryrefslogtreecommitdiff
path: root/ext/-test-/fatal
diff options
context:
space:
mode:
Diffstat (limited to 'ext/-test-/fatal')
-rw-r--r--ext/-test-/fatal/extconf.rb1
-rw-r--r--ext/-test-/fatal/rb_fatal.c19
2 files changed, 20 insertions, 0 deletions
diff --git a/ext/-test-/fatal/extconf.rb b/ext/-test-/fatal/extconf.rb
new file mode 100644
index 0000000000..e0cfeb2095
--- /dev/null
+++ b/ext/-test-/fatal/extconf.rb
@@ -0,0 +1 @@
+create_makefile("-test-/fatal/rb_fatal")
diff --git a/ext/-test-/fatal/rb_fatal.c b/ext/-test-/fatal/rb_fatal.c
new file mode 100644
index 0000000000..71aef4658a
--- /dev/null
+++ b/ext/-test-/fatal/rb_fatal.c
@@ -0,0 +1,19 @@
+#include <ruby.h>
+
+static VALUE
+ruby_fatal(VALUE obj, VALUE msg)
+{
+ const char *cmsg = NULL;
+
+ (void)obj;
+
+ cmsg = RSTRING_PTR(msg);
+ rb_fatal("%s", cmsg);
+ return 0; /* never reached */
+}
+
+void
+Init_rb_fatal(void)
+{
+ rb_define_method(rb_mKernel, "rb_fatal", ruby_fatal, 1);
+}