Is it possible to call perl inline functions from XS? I admit, I do not know.
If not, you can always do something like this:
sub logger { _real_logger(caller, @_) }
Assuming logger is what is called your function (and you rename your C ++ XS function to _real_logger ). You can also do this, presumably if you need to hide in the call tree:
sub logger { unshift @_, caller; goto &_real_logger; }
which, of course, is the normal goto form used in AUTOLOAD .
This, of course, will add overhead, but it probably won't be a big problem for the logging function.
source share