Skip to content

Instantly share code, notes, and snippets.

@djberg96
Created June 6, 2012 19:08
Show Gist options
  • Save djberg96/2883992 to your computer and use it in GitHub Desktop.
Save djberg96/2883992 to your computer and use it in GitHub Desktop.
Ruby 1.9.3 is driving me insane
# extconf.rb
require 'mkmf'
$CFLAGS += " -std=c99" # Doesn't help
create_makefile('foo')
# foo.c
#include "ruby.h"
static VALUE foo_bar(VALUE self){
const char* bar = "bar";
printf("We here?\n");
VALUE val = rb_str_new2(bar);
return val;
}
void Init_foo(){
VALUE cFoo = rb_define_class("Foo", rb_cObject);
rb_define_method(cFoo, "bar", foo_bar, 0);
}
# Output of ruby-1.9.3-p194 when I run "ruby extconf.rb"
foo.c: In function ‘foo_bar’:
foo.c:6: warning: ISO C90 forbids mixed declarations and code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment