Embedding the Ruby interpreter in C# app

N

Nick Partridge

Hi, I'm looking for some assistance in embedding the ruby interpreter
in C#. I've got well through the basics of using p/invoke to load the
C api methods, and I'm having some brain-destroying problems with
getting a ruby string back to a System.String for certain size
strings.

http://pastie.caboo.se/15227

The pastie has some snips of the code that I can reproduce the failure
with. It seems, that for arbitrarily large strings rb_string_to_cstr
fails. The value of i at which the code fails is not constant and
seems to be anywhere greater than 200. Occasionally, the code will run
through to completion.

I have no idea what I need to do here. I've tried some GCHandle
pinning of objects to no avail, but I'm pretty green at
net/C#/dllimport/p|invoke.

Has anyone done this? Or something similar and can shed some light on
my problem?

-- Nick
 

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,774
Messages
2,569,596
Members
45,144
Latest member
KetoBaseReviews
Top