RealityMage wrote:As to the last poster, you could write portable code by testing the WXUSINGDLL definition (or something like that), and using preprocessor commands to conditionally execute different macros.
Not necessary. You can write portable code by just using DECLARE_LOCAL_EVENT_TYPE for all event types declared
and defined by the app (by which I mean in one of statically-linked units). Luckily all the quirks only apply to DECLARE macros; DEFINE_LOCAL_EVENT_TYPE is (currently) just a synonym for the non-LOCAL.
The non-LOCAL is used for events residing inside wxWidgets library -- and it makes a difference only when you're building/using wx.dll. If building, it declares the event type __declspec(dllexport); if using, it's __declspec(dllimport). In all other cases (includes linking against wx static lib), it's the same as LOCAL, that is no __declspec. I really don't know why there are non-LOCALs in the docs' examples, and I think it's wrong. Probably a left-over from the days when there was no need for LOCALs.
If you plan to have a custom DLL exporting some custom event types, you'll need your own MYDECLSPEC (defined conditionally based on whether your dll is being built/used like in the previous paragraph; you can use WXEXPORT and WXIMPORT macros from "wx/dlimpexp.h" to simplify it a bit and avoid the ugly __declspec). Then put DECLARE_EXPORTED_EVENT_TYPE(MYDECLSPEC, MYEVENT, -1) in your dll's interface header instead of the ordinary. Each such dll must have it's own declspec #define, just like the above-mentioned dlimpexp.h defines WXMAKINGDLL_BASE, WXMAKINGDLL_NET, WXMAKINGDLL_CORE etc. for building wxWidgets broken into multiple dlls.