News for hackers. Stuff that matters.
Re:Zig / C++ Interop by marler8997 on Tuesday November 11, 2025 @04:59PM (#45893465)
It's a bit more than your typical "interop via C". With a "sized opaque" type you actually can stack allocate C++ values in Zig (and vice versa stack allocate Zig values in C++), i.e.

fn stackExample() void {

    var some_cpp_type: c.SomeCppType = undefined;
    c.some_cpp_type_ctor(&some_cpp_type);
    defer c.some_cpp_type_dtor(&some_cpp_type);

    // ...

}

There are no comments on this comment yet.