From: Claudio Fiorini Date: 2008-09-23T06:22:06+09:00 Subject: [ruby-core:18797] Re: Problem with MakeOpenFile On Mon, 2008-09-22 at 10:22 +0900, Yukihiro Matsumoto wrote: > Hi, > > In message "Re: [ruby-core:18771] Problem with MakeOpenFile" > on Sun, 21 Sep 2008 21:14:34 +0900, Claudio Fiorini writes: > > |static VALUE > |method_rfcomm_initialize(VALUE sock) > |{ > | int fd; > | OpenFile *fp; > | > | rb_secure(3); > | fd = ruby_socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM); > | if (fd < 0) rb_sys_fail("socket(2)"); > | > | MakeOpenFile(sock, fp); /* HERE I GET THE SEG FAULT */ > | > | fp->f = rb_fdopen(fd, "r"); > | fp->f2 = rb_fdopen(fd, "w"); > | fp->mode = FMODE_READWRITE; > | rb_io_synchronized(fp); > | > | return sock; > |} > > MakeOpenFile takes an IO object for its first argument, where you gave > an class object, since method_rbluez_initialize is a class method of a > class Rblues. > > matz. > Thanks, now works! claudio