extern WXDLLIMPEXP_DATA_BASE(HINSTANCE) wxhInstance;
 
+extern "C"
+{
+    WXDLLIMPEXP_BASE HINSTANCE wxGetInstance();
+}
+
+WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
+
 // ---------------------------------------------------------------------------
 // define things missing from some compilers' headers
 // ---------------------------------------------------------------------------
     {
         if ( IsRegistered() )
         {
-            if ( !::UnregisterClass(m_clsname.wx_str(), wxhInstance) )
+            if ( !::UnregisterClass(m_clsname.wx_str(), wxGetInstance()) )
             {
                 wxLogLastError(wxT("UnregisterClass"));
             }
 // global functions
 // ---------------------------------------------------------------------------
 
-extern "C"
-{
-    WXDLLIMPEXP_BASE HINSTANCE wxGetInstance();
-}
-
-WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
-
 // return the full path of the given module
 inline wxString wxGetFullModuleName(HMODULE hmod)
 {
 
     wxZeroMemory(wndclass);
 
     wndclass.lpfnWndProc   = (WNDPROC)wxWndProc;
-    wndclass.hInstance     = wxhInstance;
+    wndclass.hInstance     = wxGetInstance();
     wndclass.hCursor       = ::LoadCursor(NULL, IDC_ARROW);
     wndclass.hbrBackground = (HBRUSH)wxUIntToPtr(bgBrushCol + 1);
     wndclass.style         = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | extraStyles;
     {
         wxLogLastError(wxString::Format(wxT("RegisterClass(%s)"),
                        regClass.regname));
-        ::UnregisterClass(regClass.regname.c_str(), wxhInstance);
+        ::UnregisterClass(regClass.regname.c_str(), wxGetInstance());
         return NULL;
     }
 
     for ( size_t n = 0; n < count; n++ )
     {
         const ClassRegInfo& regClass = gs_regClassesInfo[n];
-        if ( !::UnregisterClass(regClass.regname.c_str(), wxhInstance) )
+        if ( !::UnregisterClass(regClass.regname.c_str(), wxGetInstance()) )
         {
             wxLogLastError(wxString::Format(wxT("UnregisterClass(%s)"),
                            regClass.regname));
         }
 
-        if ( !::UnregisterClass(regClass.regnameNR.c_str(), wxhInstance) )
+        if ( !::UnregisterClass(regClass.regnameNR.c_str(), wxGetInstance()) )
         {
             wxLogLastError(wxString::Format(wxT("UnregisterClass(%s)"),
                            regClass.regnameNR));