这个额外的关键字在这个 c++ 类声明中是什么意思?
What does this extra keyword mean in this c++ class declaration?
我正在查看一些声明如下类的C++代码:
class LIBSBML_EXTERN LayoutModelPlugin : public SBasePlugin
LIBSBML_EXTERN关键字有什么用?
这是一个宏。我不确定您正在使用什么库,但很可能是带有定义的宏,您可以在此处看到:https://github.com/copasi/copasi-dependencies/blob/master/src/libSBML/src/sbml/common/extern.h
#if ( ! defined LIBSBML_STATIC )
/**
* The following ifdef block is the standard way of creating macros which
* make exporting from a DLL simpler. All files within this DLL are
* compiled with the LIBSBML_EXPORTS symbol defined on the command line.
* This symbol should not be defined on any project that uses this
* DLL. This way any other project whose source files include this file see
* LIBSBML_EXTERN functions as being imported from a DLL, wheras this DLL
* sees symbols defined with this macro as being exported.
*
* (From Andrew Finney's sbwdefs.h, with "SBW" replaced by "LIBSBML" :)
*/
#if defined(LIBSBML_EXPORTS)
# define LIBSBML_EXTERN __declspec(dllexport)
#else
# define LIBSBML_EXTERN __declspec(dllimport)
#endif
#else
# define LIBSBML_EXTERN
#endif /* LIBSBML_STATIC */
如果需要,它用于将类定义与 DLL 接口。
它是一个宏,你可以这样定义:
#define LIBSBML_EXTERN whatever
其中whatever
是编译器在编译之前放置的LIBSBML_EXTERN
。
相关文章:
- 这个额外的关键字在这个 c++ 类声明中是什么意思?
- * 和 ** 在 C++ 函数声明中是什么意思?
- C++ [错误] 声明'char '隐藏参数。什么意思?
- C++中这个声明的向量是什么意思
- 在C++中,变量声明左侧的大括号是什么意思?
- 引用 using 声明引入的功能的句子是什么意思?
- 这个嵌套结构声明是什么意思?
- 类名(声明)后的双冒号 - 这是什么意思
- const 在具有尾随返回类型的自动退货声明中是什么意思
- 变量声明中结构的作用域解析是什么意思
- 这个声明"int(*ptr[3])();"是什么意思?
- 成员函数声明的参数列表后面的单个"与"是什么意思
- 向量对象声明后的括号是什么意思
- 声明 lambda 时<: 和 :> 是什么意思?
- c++ 声明中的 ::type 是什么意思
- 结构声明中的":"是什么意思
- C++:声明'TYPE& name(&TYPE);'是什么意思?
- C++/CLI 中的声明“String^ strtests”是什么意思
- 尝试转发声明时"->"是什么意思?
- 这个 c++ 类声明是什么意思