I'm trying to embed an interpreter in a DirectX project, so I'm using
MSVC.  I grabbed the Ruby 1.9.3 source and compiled it with MSVC's nmake
tool.

The make runs and 'nmake test' reports no problems.  I then 'nmake
install' and the installed version seems to run acceptably.  So I grab
the necessary files to embed and throw them into my project.  I can
compile, but running the program gives nothing but segfaults.

Attached is a complete (very complete) explanation of the process I'm
using to create my segfault producer.  Here's the C code of the project
itself (this is just what I'm using to test embedding before I try
putting Ruby into the main project):
----------------------
#include "ruby.h"
#pragma comment (lib, "msvcr90-ruby191.lib")

int main() {
  ruby_init();
  char* options[] = {"", "test.rb"};
  void* node = ruby_options(2, options);
  return ruby_run_node(node);
}
-------------------
If I build this in release mode and run it from the prompt I get a
detailed segfault message from Ruby.  If I build in debug mode I just
get a 'standard' windows crash.  The text of the Ruby error message is
at the bottom of the attached file.

So my question is basically, "What am I doing wrong here?"

I'm guessing it's either something I'm not reconfiguring in MSVC or else
it's just that my embed code is incorrect.  Possibly there's something
going wrong in the build of the lib file.  Either way I'm running out
of hair to pull out.  I'm working on this at home and the internet there
is on the blink, so I have to go elsewhere to get online and look for
solutions.  Please help.  Your advice may be the only thing that saves
what's left of my hair.

Thank you.  :)

Attachments:
http://www.ruby-forum.com/attachment/6855/RAAAAAAAAAAAAAGE.txt


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