gpt4 book ai didi

c++ - 类 TESTDLL_LIBSHARED_EXPORT TestDLL_lib

转载 作者:行者123 更新时间:2023-11-30 17:04:07 25 4
gpt4 key购买 nike

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

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com