我从 QLibrary
开始,在这种情况下,我遇到了 Stack Overflow 问题 "QLibrary - import a class" 。我对这个问题有一个疑问:
类声明中的TESTDLL_LIBSHARED_EXPORT
的含义是什么?
class TESTDLL_LIBSHARED_EXPORT TestDLL_lib
{
public:
TestDLL_lib();
int a;
int b;
int c;
int getValues();
};
最佳答案
请引用How to use a class in DLL?以获得详细答案。
you can export data, functions, classes, or class member functions from a DLL using the __declspec(dllexport) keyword. __declspec(dllexport) adds the export directive to the object file so you do not need to use a .def file. To export all of the public data members and member functions in a class, the keyword must appear to the left of the class name as follows:
class TESTDLL_LIBSHARED_EXPORT TestDLL_lib
关于c++ - 类 TESTDLL_LIBSHARED_EXPORT TestDLL_lib,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35928556/