[SUGGESTION] cppfront transpiler parameter to generate interoperability with C #624
raffaeler
started this conversation in
Suggestions
Replies: 2 comments
-
Sounds like a prime use-case for metafunctions.
could generate the usual Cpp2 declaration, and a Cpp1 extern "C" {
void algo(int* rp, std::size_t rs) { algo(std::span<int>{rp, rs}); }
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
@JohelEGP sounds neat :) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
My suggestion does not touch
cppfront
at all, but is a transpiler parameter to automatically generateextern C
functions to overcome the binary compatibility issues in C++.The goal is to allow consuming C++ pure libraries from other languages without messing with the mangled names and risking breaking changes with future versions of the C++ libraries and/or compilers.
The generation should be restricted to:
If I understood correctly,
cppfront
makes the parameter direction clear usingin
andout
. This metadata can be used to apply the patterns to correctly allocate/deallocate the memory for the parameters.It could be also useful to define a "type transformer" that can be used by the transpiler to extend the types that can be used in the generation. For example, a
std::vector<T>
could be mapped toT*
and length.Beta Was this translation helpful? Give feedback.
All reactions