How to Import C++ code

I have an existing project in C++ code from Powerbuilder, is it possible to import this code into a Rust project?
Pointers would be appreciated!!

C++ interfaces can't be directly imported because of the different language semantics. Especially templates are next to impossible to map into Rust except on a very restrictive case-by-case basis.

You may be interested in bindgen (Rust unsafe extern fn bindings for mostly-C-compatible APIs), cxx (machine-checked manual bindings to untemplated modern C++ via a generated C-compatible shim layer), and/or autocxx (generated cxx bindings from C++ headers).

For the other direction, consider cbindgen (generate the C header for pub extern "C" functions), cxx, and even Diplomat (higher-level Rust to foreign language bindings).


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.