one of the basic commands in a OOP language is the new() command to create a new object. How could I implement this in ASM? Imagine, the object consists of a couple of methods, a data structure for the object and a pre-defined virtual table with a given sorting of method call-in-addresses. beaster.
Posted on 2001-03-16 06:02:00 by beaster
Do you have MASM32 Service Pack 2? Look inside for the COM section. There you will find the "Inside CoLob" document, and all the source code for making COM objects. In short, you define a ClassItem structure, and pass this to the AllocObject procedure of CoLib. AllocObject reads out the information in the ClassItem, creates, initializes (runs an optional constructor too) a new object, and returns a reference to it.
Posted on 2001-03-16 08:10:00 by Ernie
Actually, with a whole day of hindsight behind me now, I think perhaps a better discussion of classed, objects, and NEW may be found in my "Creating a COM object in ASM" tutorial. Understanding the nuances of CoLib in one shot is kinda a streatch, and this tut describes a much simpler object, perhaps an initially more useful one. But in the long run, CoLib will do a lot more grunt work for you.
Posted on 2001-03-16 16:24:00 by Ernie