C++ code and objects from C?
Is there a simple way to work with C++ objects directly from C?
I want to expose some classes from C++ to C or to FFI(foreign function interface).
Sure, I can write a stuff like that:

    class Foo{
    ....
    };

    void *make_foo(...){
    Foo *ptr = new Foo(..)
    
    return static_cast<void *>(ptr);
    }

    ..

    int *foo_method1(void *fooptr, ...){
    Foo *ptr = static_cast<Foo*>(fooptr);
    }


But there is a simpler method?
C++ code and objects from C?
===

Is there a simple way to work with C++ objects directly from C?
I want to expose some classes from C++ to C or to FFI(foreign function interface).
Sure, I can write a stuff like that:

    class Foo{
    ....
    };

    void *make_foo(...){
    Foo *ptr = new Foo(..)
    
    return static_cast<void *>(ptr);
    }

    ..

    int *foo_method1(void *fooptr, ...){
    Foo *ptr = static_cast<Foo*>(fooptr);
    }


But there is a simpler method?