in reply to Re: Re: embedded perl calls c subroutines
in thread embedded perl calls c subroutines
I did "glueing" that way: (nothing unusual, I just read perlembed and related documentation)
Note usage of XS macro, "real" name of function will be more complicated after expansion of that macro.XS(TStringsTIEARRAY) { dXSARGS; SV *ssv=ST(0); // "G::TStrings" void* tmp[4]; memset(tmp,0,sizeof(tmp)); tmp[2] = 0; ((TStrings*)(tmp[0])) = TyingStrings; ((TComponent*)(tmp[1])) = TyingComp; ((int)(tmp[2])) = TyingOpt; SV *tsv; tsv = newSVpv((char*)&tmp[0],16); STRLEN len; char *ptr = SvPV(ssv,len); HV *stash = gv_stashpvn(ptr,len, TRUE); SV *rsv = newRV_inc(tsv); sv_bless(rsv,stash); ST(0) = rsv; XSRETURN(1); }
newXS("G::TStrings::TIEARRAY", TStringsTIEARRAY, "BCB+Perl interna +l");
to enable dynamic loading of modules.newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, "blablabla") +;
Courage, the Cowardly Dog
things, I do for love to perl...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: embedded perl calls c subroutines
by Anonymous Monk on Aug 14, 2002 at 16:03 UTC | |
by Courage (Parson) on Aug 14, 2002 at 16:14 UTC |