[英]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
編譯之前。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.