c++ - 类 TESTDLL_LIBSHARED_EXPORT TestDLL_lib

标签 c++ c qt c++11 qt5

我从 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/

相关文章:

c - 在 Linux 上实现 posix_spawn

c++ - 使用没有 new 的 QThread

java - 将 Java 应用程序移植到 C++ (qt)

c++ - 如何在c++中使用每个循环

c - 为什么不在函数内部执行printf?

c++ - 函数返回结构指针

c - Linux 内核在驱动程序读取功能中休眠

c++ - Qt 中的私有(private)变量

c++ - Qt 应用程序中与 Qt 版本相关的运行时错误

c++ - 如何返回一个不透明的句柄(void* 或 dword),它可以转换回存储在 boost::interprocess 映射中的值元素?