I Remember The Ghost, It Smiled: Adventures In Debugging C++/XS 2: Debugging Boogaloo
… or “Ask Not To Whom The Pointer Points, It Points To Thee.”
TL;DR: A pointer is not a reference. A pointer knows nothing about the data being pointed to. Returning multiple values requires actual work.
Everything went wrong when I wanted a string with a NUL character inside…
Because Perl/XS is technically C. Perl is written in C and xsubpp defaults to only working with C code. You can get C++ to work, but at the time this was written, I wasn’t doing that. Worse, I was working on a library that was an XS wrapper to a C wrapper for a C++ library. Now, I’ve completely re-written it to be an XS wrapper just around the C++ (with an actual sane API). And yes, I now use STL whenever I can (there are helper functions/macros to turn cstrings into Perl SVs or char buffers into Perl SVs, but not std::string).
XS has a bit of a reputation of being a crazy jackup of C and macros where only wizards dare to tread.