I want to give a c function a custom symbol name (without mangling) so that a can call it from c directly without redirection. For example: If I have the following class in c :
class Foo {
public:
Foo();
void some_method(int);
int a_;
};
I want to give Foo::some_method
a custom name like Foo_some_method
so that I can call it from c code directly without need for redirection from another function inside extern "C"
, is that possible?
CodePudding user response:
No, to enable a C conpatible calling convention and symbol name you need to produce an extern "C"
normal function (in theory, an extern "C" function pointer could also work).
So write your glue code.
It is plausible with reflection you'll be able to automate that. But that is not yet standardized, and covid 19 may delay it past 2023.