View Single Post
  #1  
Old 09-21-2009, 04:34 PM
Harakiri23
Fire Beetle
 
Join Date: Jun 2009
Location: b
Posts: 11
Default Generating Perl Classes..howto?

Dear Devs,

the perl classes like perl_client.cpp seem to be auto generated from the client.cpp to map client c++ functions into perl. I figured as much that the perl toolset using xsubpp has created these files.

I got as far as creating my own perl mapper classes for custom c++ classes, however i seem only be able to create the header (function bodies) not the implementation.

I see that these classes were originally checked in by FatherMatt? - is there a howto to build these perl_*.cpp classes ? It looks like over the years you are advised to copy & paste new functions into these classes any manually create the perl code like

Quote:
XS(XS_Client_Duck); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_Duck)
{
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Client:uck(THIS)");
{
Client * THIS;

if (sv_derived_from(ST(0), "Client")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Client *,tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type Client");
if(THIS == NULL)
Perl_croak(aTHX_ "THIS is NULL, avoiding crash.");

THIS->Duck();
}
XSRETURN_EMPTY;
}
is there a documented way to auto generate these classes including code?

Thank you
Reply With Quote