bool m_owned;
};
-// this has to be defined inside the DLL (and not e.g. as a static variable
-// inside an inline function) as otherwise MSVC gives link errors when the
-// functions are effectively inlined (i.e. in non-debug build)
-//
// NB: this is defined in string.cpp and not the (non-existent) buffer.cpp
-extern WXDLLIMPEXP_DATA_BASE(UntypedBufferData * const) untypedNullDataPtr;
+WXDLLIMPEXP_BASE UntypedBufferData * GetUntypedNullData();
} // namespace wxPrivate
// placeholder for NULL string, to simplify this code
static Data *GetNullData()
{
- return static_cast<Data *>(wxPrivate::untypedNullDataPtr);
+ return static_cast<Data *>(wxPrivate::GetUntypedNullData());
}
void IncRef()
#define wxStringStrlen wxStrlen
#endif
-// ----------------------------------------------------------------------------
-// global variables
-// ----------------------------------------------------------------------------
-
+// define a function declared in wx/buffer.h here as we don't have buffer.cpp
+// and don't want to add it just because of this simple function
namespace wxPrivate
{
-static UntypedBufferData s_untypedNullData(NULL, 0);
+// wxXXXBuffer classes can be (implicitly) used during global statics
+// initialization so wrap the status UntypedBufferData variable in a function
+// to make it safe to access it even before all global statics are initialized
+UntypedBufferData *GetUntypedNullData()
+{
+ static UntypedBufferData s_untypedNullData(NULL, 0);
-UntypedBufferData * const untypedNullDataPtr = &s_untypedNullData;
+ return &s_untypedNullData;
+}
} // namespace wxPrivate