Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Add option for aliasing common Rust types for its C++ equivalents #1057

Open
DasMatus opened this issue Feb 28, 2025 · 0 comments

Comments

@DasMatus
Copy link

It'd be nice to have this, because then you don't have to mess with rewriting the whole codebase just to support FFI.

How it should look like:

If the code contains, for example, Vec<T>, then preprocessor macro will be added on top of header redefining Vec<T> to vector<T>. Same thing with HashMap<K, V> to map<K, V>.

Example:

  • Rust file:
fn function() -> HashMap<String, String> {}
  • Generated header:
#include <cstdarg>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <ostream>
#include <new>
#define HashMap map
#define String string

using namespace std
HashMap<String, String> function();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant