Actually, the C ++ class is also a C structure. Therefore, you can simply do this:
struct Object; struct Object* Object_Create(void);
And, a C wrapper in the library, thus:
struct Object* Object_Create(void) { return new Object; }
A method call might look like this:
uint32_t Object_DoSomething( struct Object* me, char * text ) { return me->DoSomething( text ); }
I tried this and I see no flaws.
source share