in reply to converting a C pointer to a perl reference

My hunch is that there's something in your code (which you haven't provided) that's causing the problem. I believe the following Inline::C script demonstrates that we can pass strings (in both directions) via the stack that are considerably larger than 64kb. At least that's what it demonstrates on my Win32 box - as the script ouptputs "8000000".

If the same script produces the same output on your box, then I think we can conclude that the problem you're facing is something other than a stack size limit.
use warnings; use strict; use Inline C => Config => BUILD_NOISY => 1; use Inline C => <<'EOC'; void foo(char * htmFile, int len) { dXSARGS; sp = mark; XPUSHs(sv_2mortal(newSVpv(htmFile, len))); PUTBACK; XSRETURN(1); } EOC my $len = 8000000; my $z = 'z' x $len; my $copy = foo($z, $len); print length($copy), "\n";

Cheers,
Rob