Static hxcpp extension accessing cpp code

Hello,
I’m trying to create a static extension for EReg for as many targets I can.
Doing so for some of them is straightforward (f.e. js, python), since I can access even private fields of the underlying implementation using @:privateAccess (not robust - I know - but I’m happy with it for now :stuck_out_tongue_winking_eye: ).
But when it comes to cpp (…and hl and eval will present similar hurdles), I can’t find a suitable way to hack into the cpp code directly (the fields I need are not exposed - not even private - on the haxe side; in my specific case I’m interested in the value of nmatchs in RegExp.cpp).
Now, I managed to make it work by making minor changes to hxcpp (RegExp.cpp and StdLibs.h), and EReg-related .hx files in std. But then the code is not “portable”, I cannot extract it into - say - a separate lib available to other users.

Is there a way to accomplish what I described, but only writing “external” code?