Ruby-dl problem: calling func with param

R

Robert Feldt

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
 

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

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top