当使用__declspec(dllexport)
时,应该重载的操作员是否也分配了这个出口标志?例如,假设你有这样的:在类中重载运算符是否需要使用__declspec(dllexport)(如果它们用于DLL项目中)?
/*
Overloaded operator (equivalent operator) returns true if x equals compared vector
*/
__declspec(dllexport) bool operator ==(const vector &v)
{
return (x == v.x && y==v.y && z==v.z);
}
是为了在你的类的类型使用==
必要__declspec(dllexport)
?还是应该不导出,因为它是特定于该类和任何继承类?
谢谢。 Microsoft创建DLL的演练非常糟糕。在这里很高兴有人更有帮助! :) – Darkenor 2011-03-25 18:50:26