www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Writing a library

Bill Baxter Wrote:
 Every method of your class like
       void myMethod(float arg);
 will need a plain function wrapper like
        extern(C) void myClassMyMethod(MY_CLASS self, float arg);
 
 And they'll all be implemented mostly like
        extern(C) void myClassMyMethod(MY_CLASS self, float arg) {
             MyClass real_self = cast(MyClass)self;
             // [check that it really is a MyClass]
             real_self.myMethod(arg);
        }
 
 And you will need a destroy call that takes a MY_CLASS, too, and calls 
 the destructor.

The function wrapper goes inside of the class too, doesnt it? --Mn
Feb 17 2007