Sharing the code in here is a bit hard (hence the github link in the first post, which points to the whole project). Without the gRPC library installed and without the complete project, you can't run it.
Anyhow, you guessed right :-) Many thanks for that! I think the T_OPAQUE is exactly what I need. I can port to perl as well, but I think this has less impact and is fine as well.