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

J

Josh Steiner

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
 
N

Nobuyoshi Nakada

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.
 
J

Josh Steiner

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 said:
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
 
N

Nobuyoshi Nakada

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.
 
J

Josh Steiner

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 said:
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
 
N

Nobuyoshi Nakada

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,809
Latest member
moe77

Latest Threads

Top