C++ (Qt)//MyClass.hclass MySubClass; class MyClass{public: MyClass(); ~MyClass();private: MySubClass *subClass;}; //MyClass.cpp#include "MyClass.h"#include "MySubClass.h" MyClass::MyClass() : subClass(new MySubClass){} MyClass::MyClass(){ delete subClass;}
SubLib *point;void my_export init(){ point = new SubLib(); }void my_export deInit(){ if (point) { delete point; point = NULL; }}
int my_export add(int a, int b){ if (point) return point->SubLub_func(a,b); return -1;}
dll->init();int result = dll->add(a,b);dll->deInit();