From: Jacob Repp Date: 2006-02-19T04:22:14+09:00 Subject: Re: Hello, and a question about finding a defined Class from C Not long after sending this I ran a little experiment to validate the symbol IDs were the same between script and C code. My code below was correct, the problem was that I was passing -r AIO on the command line (in my debugger settings). Hence my extension init was running before I had run the require 'socket' statement. If anyone is interested in a IOCP wrapper for ruby on win32 I would like to get some feedback/testing on the implementation. Thanks, -j On 2/18/06, Jacob Repp wrote: > First of all I would like to say Hello! I am new to Ruby programming > having just started a few days ago. I have been watching the ruby > language with interest for a number of years now but finally got the > interest to dive in. I must say it has been an absolute joy. > > If this is the wrong list for a question of this type I would be happy > to post it elsewhere. > > My first project was a UDP client/server which went well up until I > ran the problem of blocking kernel calls. I have used the 'io/wait' > extension which works nicely for simple purposes but for fun I've > written an extension for Win32 IO Completion Ports. > > I have the binding code written but currently I cannot get a VALUE > representing the TCPSocket Class object. I'm trying to define the > methods async_send and async_read in the TCPSocket class currently as > a test. > > > id = rb_intern("TCPSocket"); > if (rb_const_defined(rb_cObject, id)) > { > cTCPSocket = rb_const_get(rb_cObject, id); > if (TYPE(cTCPSocket) != T_CLASS) { > rb_raise(rb_eTypeError, "%s is not a class", "TCPSocket"); > } > > rb_define_method(cTCPSocket, "async_send", rb_async_send, 2); > rb_define_method(cTCPSocket, "async_recv", rb_async_recv, 2); > } > else > { > rb_raise(rb_eTypeError, "class 'TCPSocket' was not defined you > must require 'socket'"); > } > > > > When I execute the code: > > require 'socket' > puts Object.constants > > I see the constant TCPSocket is defined. > >