【发布时间】:2011-12-24 05:12:42
【问题描述】:
如果我有一个程序 foo.exe 并在运行时加载插件 bar.dll,我如何让 bar.dll 中的代码使用 foo.exe 中的类? bar.dll 是否可以从 foo.exe 派生类?另外,这个解决方案会是跨平台的吗?
编辑:这是我正在尝试做的更多事情:
//foo.exe
class Node {
public:
void SetName(const string& n) { ... }
const string& GetName() { ... }
};
//bar.dll
class TransformNode : public Node {
public:
void DoSomething() {
SetName(...); //basically, can I inherit functionality from foo.exe (SetName and GetName)
//and reuse the code in a derived class in bar.dll?
}
};
【问题讨论】:
标签: c++ dll dynamic-linking