Writing a library
Mn
mn at mailinator.com
Sat Feb 17 03:34:52 PST 2007
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
More information about the Digitalmars-d
mailing list