On Mar 28, 8:36 pm, Christophe Mckeon <poly... / yahoo.com> wrote:
> Daniel Berger wrote:
> > On Mar 28, 7:49 pm, Christophe Mckeon <poly... / yahoo.com> wrote:
> >> hi,
>
> >> how do you set the include file path for your extension? can it be done
> >> using mkmf? right now i'm going #include "../drp.h" which is kind of
> >> ugly.
>
> > find_header('drp.h', '..')
>
> > Regards,
>
> > Dan
>
> thanks but that doesn't work, i still get errors

Works for me. I put a 'bar.h' in the toplevel directory. My extconf.rb
file looks like this:

require 'mkmf'
find_header('bar.h', '..')
create_makefile('foo')

The foo.c file looks like this:

#include <ruby.h>
#include <bar.h> /* Quotes or braces will work */

void Init_foo(){
   VALUE mFoo = rb_define_class("Foo", rb_cObject);
}

$ ruby extconf.rb
checking for #include <bar.h>
... yes
creating Makefile

$ make
gcc -I. -I/usr/local/lib/ruby/1.8/i686-darwin8.9.1 -I/usr/local/lib/
ruby/1.8/i686-darwin8.9.1 -I. -I..  -fno-common -g -O2 -pipe -fno-
common  -c foo.c
cc -dynamic -bundle -undefined suppress -flat_namespace  -L"/usr/local/
lib" -o foo.bundle foo.o  -ldl -lobjc

After you run extconf.rb, open up the Makefile and look for INCFLAGS.
You should see "-I..". If you don't then something went seriously
wrong.

Regards,

Dan