From: Dennis Newbold Date: 2002-04-24T03:37:38+09:00 Subject: Re: building extensions-- new vs initialize Hi Norman, Try using SWIG to build your extension. Some on this list have had a few problems getting the resulting code to run properly, (then again, it may). But you can look at the generated code startup logic (entry point Init_ Hi, I'm trying to build a ruby extension in C. While looking at the pickaxe CD > player example, I noticed that they define a singleton_method called "new" and > then a normal method called "initialize". What is the motivation for this? Is > it so that when you call CDPlayer.new, the returned object is of type Data? > (this can't be achieved with just initialize?) > > I'm confused as to when it is or not neccessary to define a "new" method in > addition to an "initialize" method. For example, when defining class variables, > does this have to be done in a "new" method, since the class has not been > instantiated? > > One last thing, would someone mind giving me the an example of the correct way > to make a class that includes the Singleton method and then define the > "instance" method (using rb_require, rb_include_module, etc...) > > Thank you, please excuse my inexperience, > > -- > Norman >