简体   繁体   中英

wxWidgets in c++ on windows

I was reading this particular code snippet:-

  class WXDLLIMPEXP_CORE wxCommandEvent : public wxEvent, public wxEventBasicPayloadMixin

this is defined in event.h header file , i didn't understand "WXDLLIMPEXP_CORE".

Thanks

If we have a look at where it is defined we see

#ifdef WXMAKINGDLL_CORE
#    define WXDLLIMPEXP_CORE WXEXPORT
#    define WXDLLIMPEXP_DATA_CORE(type) WXEXPORT type
#    if defined(HAVE_VISIBILITY)
#        define WXDLLIMPEXP_INLINE_CORE WXEXPORT
#    else
#        define WXDLLIMPEXP_INLINE_CORE
#    endif
#elif defined(WXUSINGDLL)
#    define WXDLLIMPEXP_CORE WXIMPORT
#    define WXDLLIMPEXP_DATA_CORE(type) WXIMPORT type
#    if defined(HAVE_VISIBILITY)
#        define WXDLLIMPEXP_INLINE_CORE WXIMPORT
#    else
#        define WXDLLIMPEXP_INLINE_CORE
#    endif
#else /* not making nor using DLL */
#    define WXDLLIMPEXP_CORE
#    define WXDLLIMPEXP_DATA_CORE(type) type
#    define WXDLLIMPEXP_INLINE_CORE
#endif

The comments elsewhere in the file are pretty explanatory as to what is happening, but a brief summary is that there are three cases, we are making a DLL, using a DLL or not using one at all. The last case is the simplest, if we are not using DLLs at all then they are defined away to nothing. If we are making a DLL then it marks the class as exported, and if we are using a DLL then it marks the class as imported.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM