From: mortee on
Hi!

It's been quite long since I last posted here, but now I feel I'm stuck.

What I'm trying is to embed a ruby interpreter into a (multi-threaded)
3rd party app (using its scripting interface and its ability to load
DLLs through it), and run my ruby code by it. After much trial and
error, I've managed to have it work to the extent that I can call into
my own ruby code without having it crash the app.

However, anytime I try to access any networking abilities from ruby, it
crashes the host app immediately, with a MS Visual C++ Runtime dialog
telling me that it's requested to terminate the app in an unusual way,
and a sole OK button. There's no logs, standard output, anything.

Does anyone have some insight as to how I could circumvent this problem?

Some details: I'm trying to embed MRI ruby 1.8.7 (2008-08-11 patchlevel
72) [i386-mswin32] through a DLL compiled using MinGW gcc on WinXP SP2,
and tried to run it on SP3.

thx in advance
mortee


From: Roger Pack on

> Some details: I'm trying to embed MRI ruby 1.8.7 (2008-08-11 patchlevel
> 72) [i386-mswin32] through a DLL compiled using MinGW gcc on WinXP SP2,
> and tried to run it on SP3.

How about the rubyinstaller version?
-rp
--
Posted via http://www.ruby-forum.com/.

From: mortee on
On 04/07/2010 00:48, Roger Pack wrote:
>
>> Some details: I'm trying to embed MRI ruby 1.8.7 (2008-08-11 patchlevel
>> 72) [i386-mswin32] through a DLL compiled using MinGW gcc on WinXP SP2,
>> and tried to run it on SP3.
>
> How about the rubyinstaller version?
> -rp

I've tried using the latest versions from the rubyinstaller page, though
not the self-installing versions, but the 7zip stuff. It still crashes
using both of these:

ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32]
ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32]


From: Caleb Clausen on
On 4/5/10, mortee <mortee.lists(a)kavemalna.hu> wrote:
> What I'm trying is to embed a ruby interpreter into a (multi-threaded)
> 3rd party app (using its scripting interface and its ability to load
> DLLs through it), and run my ruby code by it. After much trial and
> error, I've managed to have it work to the extent that I can call into
> my own ruby code without having it crash the app.
>
> However, anytime I try to access any networking abilities from ruby, it
> crashes the host app immediately, with a MS Visual C++ Runtime dialog
> telling me that it's requested to terminate the app in an unusual way,
> and a sole OK button. There's no logs, standard output, anything.

This is just a wild guess, but it's possible that embedding in a
multi-threaded program is what gives you grief. Suraj Kurapatni (sp?)
was having problems with it a while ago. I don't remember the exact
details, but it seems that ruby likes the stack(s) to be where _it_
wants them to be... he eventually came up with some patches to let you
at least tell ruby where the stacks actually are, but I don't think
they were accepted. I'd point you at the relevant bug report on
redmine, but it's seemingly down for repairs right now. :(

From: Roger Pack on

> Does anyone have some insight as to how I could circumvent this problem?

Make sure to run your ruby code in only one thread at a time and only
from the "main" thread (?)

You could post backtraces, as well.
-rp
--
Posted via http://www.ruby-forum.com/.