/*
* THIS FILE WAS GENERATED BY PDL::PP! Do not modify!
*/
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "pdl.h"
#include "pdlcore.h"
#include "pdlsimple.h"
static Core* PDL; /* Structure hold core C functions */
SV* CoreSV; /* Get's pointer to perl var holding core structure */
MODULE = PDL::CallExt PACKAGE = PDL::CallExt
# Call an external C routine loaded dynamically - pass PDL args list
void
_callext_int(...)
PPCODE:
int (*symref)(int npdl, pdlsimple **x);
int npdl = items-1;
pdlsimple **x;
pdl *t;
int i;
symref = (int(*)(int, pdlsimple**)) INT2PTR(void*,SvIV(ST(0)));
New( 42, x, npdl, pdlsimple* ); /* Ptr array */
for(i=0; i<npdl; i++) {
t = PDL->SvPDLV(ST(i+1));
PDL->make_physical(t);
PDL->make_physdims(t);
New(42, x[i], 1, pdlsimple); /* Each ptr */
x[i]->datatype = t->datatype;
x[i]->data = t->data;
x[i]->nvals = t->nvals;
x[i]->dims = t->dims;
x[i]->ndims = t->ndims;
}
i = (*symref)(npdl, x);
if (i==0)
barf("Error calling external routine");
for(i=0; i<npdl; i++) /* Free stuff */
Safefree(x[i]);
Safefree(x);
BOOT:
/* Get pointer to structure of core shared C routines */
CoreSV = perl_get_sv("PDL::SHARE",FALSE); /* SV* value */
if (CoreSV==NULL)
croak("This module requires use of PDL::Core first");
PDL = INT2PTR(Core*,SvIV( CoreSV )); /* Core* value */