Hi All,
I'm beginning to work on a ruby module for aolserver, and I have the
following basic issue.
If I call:
rb_eval_string_protect(string, NULL);
Well, it does nothing yet, but it is presumably executing the ruby and
carrying on (not capturing output yet).
If I call it like:
int rb_state = 0;
rb_eval_string_protect(string, &rb_state);
My binary dies a segfault.
Before I dig out gdb, I was wondering if there was a likely simple cause.
Cheers,
Mark.
···
--
Mark Aufflick
e: mark@pumptheory.com
w: mark.aufflick.com
p: +61 438 700 647
f: +61 2 9436 4737
Hi Matz,
Thanks for the reply. It turns out that at 10am I am thinking more
clearly than I was at 1am!
On your prompting I went back to look at my initialisation code I
realised that I had in fact missed initialising a naviserver string -
so nothing to do with ruby at all.
It's now working fine - I can't believe it's so easy! Where should I
be looking for information on embedding ruby with respect to things
like thread safety etc.?
Another quick question - to log ruby evaluation errors I'm doing:
rb_eval_string_protect(rb_code_string, &rb_state);
if (rb_state) {
Ns_Log(Debug, "ruby eval failed : %d", rb_state);
Ns_Log(Debug, "ruby $! : %s", STR2CSTR(rb_inspect(rb_gv_get("$!"))));
}
Do you think that's the best way? I've seen code that extracts the
message directy, but I figure that this is the most future proof way.
Cheers,
Mark.
···
On 5/22/06, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:
Hi,
In message "Re: segfault when calling rb_eval_string_protect with a non-null state pointer" > on Sun, 21 May 2006 23:49:43 +0900, "Mark Aufflick" <mark-ruby@aufflick.com> writes:
>I'm beginning to work on a ruby module for aolserver, and I have the
>following basic issue.
Without the source code to reproduce the problem, we cannot help
much. Did you initialize the interpreter properly before calling
rb_eval_string_protect()?
matz.
========================================================================
iBurst Wireless Broadband from $34.95/month www.platformnetworks.net
Forward undetected SPAM to: spam@mailsecurity.net.au
--
Mark Aufflick
e: mark@pumptheory.com
w: mark.aufflick.com
p: +61 438 700 647
f: +61 2 9436 4737