From: Jacob Repp Date: 2006-02-19T03:59:53+09:00 Subject: Hello, and a question about finding a defined Class from C 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.