【发布时间】:2015-07-22 18:45:14
【问题描述】:
我知道标题有点混乱,但让我解释一下:
我有这样的 A 类:
class A : public Parent
{
public:
//other methods and stuff
void run()
{
execute(arr, size_of_array);
}
virtual void execute(int tab[], int size) = 0;
};
我有实现此方法的 B 类执行如下:
class B : public A
{
public:
void execute(int tab[], int size)
{
//do something here
}
};
B 类在静态库中,A 类在动态库中。 在主程序中,我想加载符号“run”并调用此方法,以便此方法将从该静态库中调用执行函数。这可能吗? 我想我需要以某种方式将此静态库链接到共享库,这样就不会有任何未定义的引用?
我有点卡在这里,所以我会很感激任何帮助。谢谢
【问题讨论】:
-
run是一个非静态成员函数,需要A的实例才能调用。
标签: c++ linker shared-libraries static-libraries