I sadly think this is just not possible unless the common API is extremely restrictive, and for that case we already have C FFIs.
Even something relatively simple like generics just works so differently depending on the language. C++'s templates are just fundamentally incompatible with how Java generics work.