[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

embedding interpreter --- how to load ext's?

Josh Steiner

4/20/2007 12:30:00 AM

Hello all,

i just got the office source distribution of 1.8.6 to compile into a
lib with visual studio 2005 (vc8) using the nmake method... it worked
very well, i only ran into one problem which trying to compile it with
the -MDd debug runtime here:

bigdecimal.c line 1958:

static int gfDebug = 1; /* Debug switch */

that was commented out which caused the build to fail... simple fix though.

So, my question is this: I have linked the interpreter into my VC++
project successfully, but when I try to have a ruby script use ext's
like "stringio" it throws an error. any idea how i could get this
embedded ruby interpreter to load ext's?

i'm using the msvcr80-ruby18-static.lib and compiled it with "configure
--with-static-linked-ext"

in particular i mean "require 'stringio'" just returns an error that
says "no such file to load - stringio" ...

anyhow, if you have any insight i appreciate it

-Josh

--
________________________________________________________________
tasty electronic music vittles -- bluevitriol.com
the only music blog you need -- playtherecords.com
you are the dj. interactive music -- improbableorchestra.com
random observations of the bizarre -- vitriolix.com


5 Answers

Nobuyoshi Nakada

4/20/2007 4:26:00 AM

0

Hi,

At Fri, 20 Apr 2007 09:29:45 +0900,
Josh Steiner wrote in [ruby-talk:248508]:
> i'm using the msvcr80-ruby18-static.lib and compiled it with "configure
> --with-static-linked-ext"

static.lib doesn't obtain extensions. You'll see
ext/stringio/stringio.lib and so on after compiled with
static-linked-ext, and need to link them.

--
Nobu Nakada

Josh Steiner

4/20/2007 7:58:00 PM

0

ahh, thanks for the reply. That makes sense. I am now linking
stringio.lib into my executable, but still i get

"no such file to load -- stringio"

when i do a:

require "stringio"

-josh


Nobuyoshi Nakada wrote:
> Hi,
>
> At Fri, 20 Apr 2007 09:29:45 +0900,
> Josh Steiner wrote in [ruby-talk:248508]:
>
>> i'm using the msvcr80-ruby18-static.lib and compiled it with "configure
>> --with-static-linked-ext"
>>
>
> static.lib doesn't obtain extensions. You'll see
> ext/stringio/stringio.lib and so on after compiled with
> static-linked-ext, and need to link them.
>
>


--
________________________________________________________________
tasty electronic music vittles -- bluevitriol.com
the only music blog you need -- playtherecords.com
you are the dj. interactive music -- improbableorchestra.com
random observations of the bizarre -- vitriolix.com


Nobuyoshi Nakada

4/21/2007 1:47:00 PM

0

Hi,

At Sat, 21 Apr 2007 04:58:04 +0900,
Josh Steiner wrote in [ruby-talk:248581]:
> ahh, thanks for the reply. That makes sense. I am now linking
> stringio.lib into my executable, but still i get
>
> "no such file to load -- stringio"

You need ext/extinit.obj too, to initialize statically linked
extensions.

--
Nobu Nakada

Josh Steiner

4/24/2007 11:25:00 PM

0

thanks for the advice. i spent some time looking at the source of the
ruby interpreter and it looks like search_required will only load .rb,
so, .o or .dll on a windows machine. the build process only cranks out
an .obj and a .lib file. if i rename stringio.obj to stringio.so or
stringio.dll it tries to load it and fails with:

193: %1 is not a valid Win32 application. - ./stringio.so

this .obj file is built at the same time as the .lib i am using as the
embedded interpreter so it isnt a compiler version issue.

interestingly, if i copy the stringio.so that i got from the one click
installer into my running folder for my embedded ruby i get the same
error.

but isn't the point of linking the .lib into my exe to have the stringio
object available without having to dynamically load the object file?

anyone have any ideas for me?

apologies if i am being a bit foolish ;)

thanks!

-Josh


Nobuyoshi Nakada wrote:
> Hi,
>
> At Sat, 21 Apr 2007 04:58:04 +0900,
> Josh Steiner wrote in [ruby-talk:248581]:
>
>> ahh, thanks for the reply. That makes sense. I am now linking
>> stringio.lib into my executable, but still i get
>>
>> "no such file to load -- stringio"
>>
>
> You need ext/extinit.obj too, to initialize statically linked
> extensions.
>
>


--
________________________________________________________________
tasty electronic music vittles -- bluevitriol.com
the only music blog you need -- playtherecords.com
you are the dj. interactive music -- improbableorchestra.com
random observations of the bizarre -- vitriolix.com


Nobuyoshi Nakada

4/26/2007 4:21:00 PM

0

Hi,

At Wed, 25 Apr 2007 08:25:07 +0900,
Josh Steiner wrote in [ruby-talk:249008]:
> thanks for the advice. i spent some time looking at the source of the
> ruby interpreter and it looks like search_required will only load .rb,
> .so, .o or .dll on a windows machine.

Link *.lib and *.obj statically.

> the build process only cranks out
> an .obj and a .lib file. if i rename stringio.obj to stringio.so or
> stringio.dll it tries to load it and fails with:
>
> 193: %1 is not a valid Win32 application. - ./stringio.so

Of course. An object file isn't a DLL.

> interestingly, if i copy the stringio.so that i got from the one click
> installer into my running folder for my embedded ruby i get the same
> error.

One click installer is built with VC6, but you use VC8.

--
Nobu Nakada