From: "J.Hawkesworth" Date: 2003-09-08T19:31:26+09:00 Subject: Re: Ruby-dl problem: calling func with param Hello Robert, I think maybe there is a problem with your installation of ruby or gcc? I just built ruby from sources on RedHat 8.0, gcc version 3.2 20020903 then copy and pasted your code. I had to change test.rb dlload 'test.so' to dlload '/home/machine/test/test.so' but once I'd done that it compiled and ran fine: [user@machine test]$ ruby test.rb Hello! 1 3 [user@machine test]$ echo $? 0 [user@machine test]$ I have just noticed that you are using cygwin - maybe the problem is there? Hope this helps, Jon -----Original Message----- From: Robert Feldt [mailto:feldt@ce.chalmers.se] Sent: 08 September 2003 09:50 To: ruby-talk ML Subject: Ruby-dl problem: calling func with param 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 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 ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ _____________________________________________________________________ This message has been checked for all known viruses by Star Internet delivered through the MessageLabs Virus Control Centre. For further information visit http://www.star.net.uk/stats.asp _____________________________________________________________________ Any views or personal opinions expressed within this email may not be those of Talis Information Ltd. The content of this email message and any files that may be attached are confidential, and for the usage of the intended recipient only. If you are not the intended recipient, then please return this message to the sender and delete it. Any use of this e-mail by an unauthorised recipient is prohibited.