my $hashref; my $result = dir_size("C:\\temp", $hashref); print "File count = ", $hashref->{FileCount}, "\n"; print "Dir size = ", $hashref->{LowSize}, "\n";
I have this XS function defined:
int dir_size (dirname,dirinfo,permsdie=0,otherdie=0) PREINIT: AV *errs = newAV(); HV *newdirinfo = newHV(); unsigned long hightotalsize = 0; unsigned long lowtotalsize = 0; long filecount = 0; long dircount = 0; INPUT: SV *dirinfo; char *dirname; int permsdie; int otherdie; CODE: RETVAL = _dir_size (errs, permsdie, otherdie, dirname, &highto +talsize, &lowtotalsize, &filecount, &dircount); hv_store(newdirinfo, "Errors", 6, newRV((SV *)errs), 0) +; hv_store(newdirinfo, "HighSize", 8, newSVuv(hightotalsize), + 0); hv_store(newdirinfo, "LowSize", 7, newSVuv(lowtotalsize +), 0); hv_store(newdirinfo, "FileCount", 9, newSViv(filecount), 0) +; hv_store(newdirinfo, "DirCount", 8, newSViv(dircount), 0); dirinfo = newRV_noinc((SV *)newdirinfo); printf("Found %i files\n", filecount); OUTPUT: dirinfo RETVAL
The printf() call in the above XS spits out the right number, but back in perl, my $hashref is undef. Any ideas?
In reply to XS returning undef? by meetraz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |