Calling zig function from Cpp

Hi i am new to zig . can u simply show me how can i invoke a zig function from cpp?

Welcome @fahara02

You must export the zig function and declare it extern "C" in C++.

export fn inc(v: c_int) c_int {
    return v + 1;
}
extern "C" int inc(int);
2 Likes