Hi,
I'm thinking of writing some XS wrappers around C++ classes (sort of -
actually, it's Windows COM interfaces). I'm hoping to autogenerate as much
of the work as I can, rather than typing it all in manually.

This is all a bit theoretical at the moment, so I apologise in advance if
it's a bit vague...

What I'd like to do is to keep all the code relating to a given
class/interface together. That will consist of little more than a number of
method definitions (probably pretty trivial) and a ISA array (all COM
interfaces inherit from IUnknown, which supplies a couple of critical
methods, including the destructor.

In Perl, it would be

package Win32::COM::IUnknown;

sub QueryInterface {
    # magic
}

sub DESTROY {
    # magic
}

package Win32::COM::IStorage;

@ISA = qw(Win32::COM::IUnknown);

sub StorageMethodA {
    # magic
}

This is all pretty trivial, and the translation to XS should be fairly
trivial, too. Except that ISA setting...

I know that I can do the "normal" thing and put the ISA in the pm file, and
the rest in the XS. In fact, this is what I'll do initially in any case. But
I wonder if there is an easy way of specifying the inheritance in the XS, so
that the whole of the class definition stuff is in one place...

Paul Moore.

Reply via email to