[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Ruby-dl problem: calling func with param

Robert Feldt

9/8/2003 8:50:00 AM

Hi,

I'm trying out ruby-dl and it looks great. However,
I get a seg fault when calling funcs that take parameters.
Anyone can spot the problem?

Here's a transcript showing what I did:

$ cat test.c
#include <stdio.h>

extern void hello()
{
printf("Hello!\n");
}

extern int one()
{
return 1;
}

extern int inc(int n)
{
return (n+1);
}

feldt@novomundo1 /tmp/using_ruby_dl/test
$ gcc -shared -o test.so test.c

feldt@novomundo1 /tmp/using_ruby_dl/test
$ cat test.rb
require 'dl/import'
module Test
extend DL::Importable
dlload 'test.so'

extern "void hello()"
extern "int one()"
extern "int inc(int)"
end
Test.hello
p Test.one
p Test.inc(2)

feldt@novomundo1 /tmp/using_ruby_dl/test
$ ruby test.rb
Hello!
1
(eval):5: [BUG] Segmentation fault
ruby 1.8.0 (2003-09-06) [i386-cygwin]

Segmentation fault (core dumped)

Regards,

Robert Feldt



2 Answers

Takaaki Tateishi

9/8/2003 11:55:00 AM

0

Robert Feldt said:
> feldt@novomundo1 /tmp/using_ruby_dl/test
> $ ruby test.rb
> Hello!
> 1
> (eval):5: [BUG] Segmentation fault
> ruby 1.8.0 (2003-09-06) [i386-cygwin]
>
> Segmentation fault (core dumped)

Would you try to rebuild ruby-dl by
"ruby extconf.rb --enable-dlstack"?
--
Takaaki Tateishi <ttate@ttsky.net>

Robert Feldt

9/8/2003 12:00:00 PM

0

Takaaki Tateishi <ttate@ttsky.net> skrev den Mon, 8 Sep 2003 20:54:50 +0900:

> Would you try to rebuild ruby-dl by
> "ruby extconf.rb --enable-dlstack"?
>
Yes, that did it. It works now.

Thank you,

Robert