wxAppConsole *m_app;
};
-// another tiny class which simply exists to ensure that wxEntryCleanup is
-// always called
-class wxCleanupOnExit
-{
-public:
- ~wxCleanupOnExit() { wxEntryCleanup(); }
-};
-
// ----------------------------------------------------------------------------
// private functions
// ----------------------------------------------------------------------------
int wxEntryReal(int& argc, wxChar **argv)
{
// library initialization
- if ( !wxEntryStart(argc, argv) )
+ wxInitializer initializer(argc, argv);
+
+ if ( !initializer.IsOk() )
{
#if wxUSE_LOG
// flush any log messages explaining why we failed
return -1;
}
- // if wxEntryStart succeeded, we must call wxEntryCleanup even if the code
- // below returns or throws
- wxCleanupOnExit cleanupOnExit;
-
- WX_SUPPRESS_UNUSED_WARN(cleanupOnExit);
-
wxTRY
{
// app initialization
// wxInitialize/wxUninitialize
// ----------------------------------------------------------------------------
+bool wxInitialize()
+{
+ return wxInitialize(0, (wxChar**)NULL);
+}
+
bool wxInitialize(int argc, wxChar **argv)
{
wxCRIT_SECT_LOCKER(lockInit, gs_initData.csInit);
return wxEntryStart(argc, argv);
}
+#if wxUSE_UNICODE
+bool wxInitialize(int argc, char **argv)
+{
+ wxCRIT_SECT_LOCKER(lockInit, gs_initData.csInit);
+
+ if ( gs_initData.nInitCount++ )
+ {
+ // already initialized
+ return true;
+ }
+
+ return wxEntryStart(argc, argv);
+}
+#endif // wxUSE_UNICODE
+
void wxUninitialize()
{
wxCRIT_SECT_LOCKER(lockInit, gs_initData.csInit);