Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / What's mean by "WXDLLEXPORT"??

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. What's mean by "WXDLLEXPORT"??
#4077
Posted by: Aison 2004-05-08 17:52:57

class WXDLLEXPORT wxCheckBox;
class WXDLLEXPORT wxNotebook;
class WXDLLEXPORT wxSizer;
class WXDLLEXPORT wxTextCtrl;

I found such code in the wxwindows's sample widget,in the file "widgets.h",
I was puzzled by "WXDLLEXPORT",what doesn't it mean?
who can tell me?
Message2. Re: What's mean by "WXDLLEXPORT"??
#4079
Posted by: upCASE 2004-05-08 18:45:59
Hi!
I'm pretty sure that WXDLLEXPORT is defined as something like __declspec(dllexport). This does matter if you're working with a DLL realease of wxWidgets (compiled it as a DLL).
Check this article on MSDN for a short description:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccelng/htm/msmod_20.asp
upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Message3. Re: What's mean by "WXDLLEXPORT"??
#4091
Posted by: 2004-05-10 14:16:54
In wx/defs.h, you can get the following codes.

// WXDLLEXPORT maps to export declaration when building the DLL, to import
// declaration if using it or to nothing at all if we don't use wxWin DLL
#ifdef WXMAKINGDLL
    #define WXDLLEXPORT WXEXPORT
    #define WXDLLEXPORT_DATA(type) WXEXPORT type
    #define WXDLLEXPORT_CTORFN
#elif defined(WXUSINGDLL)
    #define WXDLLEXPORT WXIMPORT
    #define WXDLLEXPORT_DATA(type) WXIMPORT type
    #define WXDLLEXPORT_CTORFN
#else // not making nor using DLL
    #define WXDLLEXPORT
    #define WXDLLEXPORT_DATA(type) type
    #define WXDLLEXPORT_CTORFN
#endif

and you know WXDLLEXPORT = WXEXPORT or = WXIMPORT or = NULL

then In the same file, you can get the following codes.

#if defined(__WXMSW__)
    // __declspec works in BC++ 5 and later, Watcom C++ 11.0 and later as well
    // as VC++ and gcc
    #if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__GNUC__) || defined(__WATCOMC__) || defined(__DIGITALMARS__)
        #define WXEXPORT __declspec(dllexport)
        #define WXIMPORT __declspec(dllimport)
    #else // compiler doesn't support __declspec()
        #define WXEXPORT
        #define WXIMPORT
    #endif
#elif defined(__WXPM__)
    #if defined (__WATCOMC__)
        #define WXEXPORT __declspec(dllexport)
        // __declspec(dllimport) prepends __imp to imported symbols. We do NOT
        // want that!
        #define WXIMPORT
    #elif (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 )))
        #define WXEXPORT _Export
        #define WXIMPORT _Export
    #endif
#elif defined(__WXMAC__)
    #ifdef __MWERKS__
        #define WXEXPORT __declspec(export)
        #define WXIMPORT __declspec(import)
    #endif
#endif

so WXDLLEXPORT is __declspec(export) usually, sometimes it's __declspec(import) and sometimes it's null.
Message4. Re: What's mean by "WXDLLEXPORT"??
#4095
Posted by: Aison 2004-05-11 20:25:04
    Thanks for upCASE and sunwhite's help!
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2024-4-19  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0