+    wxASSERT_MSG(m_handle == 0, _T("Library already loaded."));
+
+    // add the proper extension for the DLL ourselves unless told not to
+    wxString libname = libnameOrig;
+    if ( !(flags & wxDL_VERBATIM) )
+    {
+        // and also check that the libname doesn't already have it
+        wxString ext;
+        wxFileName::SplitPath(libname, NULL, NULL, &ext);
+        if ( ext.empty() )
+        {
+            libname += GetDllExt();
+        }
+    }
+
+    // different ways to load a shared library
+    //
+    // FIXME: should go to the platform-specific files!
+#if defined(__WXPM__) || defined(__EMX__)
+    char err[256] = "";
+    DosLoadModule(err, sizeof(err), libname.c_str(), &m_handle);
+#else // this should be the only remaining branch eventually
+    m_handle = RawLoad(libname, flags);
+#endif