On 3 aoû¹, 17:17, "Tim Pease" <tim.pe... / gmail.com> wrote:
> On 8/3/07, unbewust <yvon.thora... / gmail.com> wrote:
>
>
>
> > BUT, for the time being in order to use, from C, the RAliasFile class,
> > i'm obliged to use :
>
> > rb_eval_string("require '/absolute/path/to/raliasfile'");
>
> rb_require( "relative/path/to/raliasfile" );
>
> My preference is relative paths. Eventually you'll want to release
> this as a gem to other developers, and they might not have the exact
> some directory structure that you do.
>
>
>
> > then to return an instance of this class :
>
> > VALUE alias = rb_eval_string("RAliasFile.new(arg)");
>
> VALUE alias = rb_class_new_instance( 1, args, RAliasFile );
>
> Where 1 is the number of arguments in the args array, args is the
> array of arguments (as a VALUE*), and RAliasFile is a reference to the
> class you would like to create.
>
>
>
> > also is my dir hierarchy shown above the best way ?
>
> Unless you need separate modules, I would flatten your directory tree
> -- i.e. consolidate all the files in your ext/lib folder up into the
> ext folder.
>
>
>
> > any comment appreciated ;-)
>
> Hope these were helpful suggestions.
>
> Blessings,
> TwP

OK with relative path this is OK now, the prob arroses because my ruby
file to test was in another folder.

BUT i still have prob with "rb_require('raf/raliasfile');" :
//make => rosxutils.c:105: warning: passing argument 1 of rb_require
makes pointer from integer without a cast
// run => ./sample.rb:124: [BUG] Segmentation fault

may be it's only the form of the argument in cause here ie 'raf/
raliasfile' (see make result).

remarks here my set-up is still with a sub-dir (renamed raf instead of
lib) :

ext/
    extconf.rb
    Makefile
    raf/
		dll_path.c
		dll_path.h
		extconf.rb
		Makefile
		raliasfile.bundle
		RAliasFile.c
		RAliasFile.o
	rosxutils.bundle
	rosxutils.c
	rosxutils.o
	sample.rb
	UnixUtils.c
	UnixUtils.h
	UnixUtils.o

remarks also if i make use of rb_eval_string('relative path')
everything wents OK.

the prob with absolute path cames from my sample.rb file (then ruby
side) which wasn't, at that time in the dir ext...


NOW if I put everything in the same diretory and adding $static = true
in extconf.rb i get :

./sample.rb:124:in `mkAlias': undefined class/module RAliasFile
(ArgumentError)

i don't have any file to load except rosxutils

then is there a way to know, afterwards what's in a bundle file ???


thanks for your help !

obviously when a first version OK i'll release that as a gem...

Yvon