[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

mkmf extconf include path

polypus

3/29/2007 1:50:00 AM

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.

thanks,
_c

--
Posted via http://www.ruby-....

7 Answers

Daniel Berger

3/29/2007 2:05:00 AM

0

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

polypus

3/29/2007 2:36:00 AM

0

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

Building native extensions. This could take a while...
drp_ext_rule_engine.c:20:17: error: drp.h: No such file or directory

this is what my extconf looks like:

require 'mkmf'

have_library 'c', 'main'
find_header 'drp.h', '..'
create_makefile 'drp_ext_rule_engine'

and in my C file i have:

#include "drp.h"

but if i have:

#include "../drp.h"

either with or without the find_header it works fine. i am
building through the extensions attribute of gemspec, not by hand.

regards,
_c






--
Posted via http://www.ruby-....

Ara.T.Howard

3/29/2007 3:22:00 AM

0

polypus

3/29/2007 4:26:00 AM

0


> you mean you are creating an extonf.rb?
>

yes an extconf like i said above.


--
Posted via http://www.ruby-....

Daniel Berger

3/29/2007 1:20:00 PM

0



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




Ara.T.Howard

3/29/2007 1:41:00 PM

0

Daniel Berger

3/29/2007 2:41:00 PM

0

On Mar 29, 7:41 am, ara.t.how...@noaa.gov wrote:
> On Thu, 29 Mar 2007, Daniel Berger wrote:
> > cc -dynamic -bundle -undefined suppress -flat_namespace -L"/usr/local/
> > lib" -o foo.bundle foo.o -ldl -lobjc
>
> so even you are on a mac now eh dan? ;-)

Yah. This is why you'll be seeing a bunch of new releases from the
sysutils project in the coming weeks. :)

I'll probably setup bootcamp and do the Vista/OS X thing at some
point.

Dan