* Implement dynamic loading of the Cairo DLL on Windows similar to how it was
done for GDI+. * Enable the use of the wxCairoContext on MSW. * Enable creating a wxGCDC from an exisiting wxGraphicsContext. * Since it's possible for a DLL that is using wx to not be on the PATH nor in the same location as the .exe, change the wxDynamicLibrary::RawLoad method to explicitly look first in the same place as the main wx-using binary. This way it will find DLLs that are in the same folder as the wx-using binary even if that would not be in the normal DLL search path. * Change wxDCImpl and wxDC::GetLogicalScale to be const methods. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68935 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "wx/msw/private.h"
|
||||
#include "wx/msw/debughlp.h"
|
||||
#include "wx/filename.h"
|
||||
|
||||
const wxString wxDynamicLibrary::ms_dllext(wxT(".dll"));
|
||||
|
||||
@@ -224,13 +225,37 @@ wxDllType wxDynamicLibrary::GetProgramHandle()
|
||||
// loading/unloading DLLs
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH 260 // from VC++ headers
|
||||
#endif
|
||||
|
||||
/* static */
|
||||
wxDllType
|
||||
wxDynamicLibrary::RawLoad(const wxString& libname, int flags)
|
||||
{
|
||||
return flags & wxDL_GET_LOADED
|
||||
? ::GetModuleHandle(libname.t_str())
|
||||
: ::LoadLibrary(libname.t_str());
|
||||
if (flags & wxDL_GET_LOADED)
|
||||
return ::GetModuleHandle(libname.t_str());
|
||||
|
||||
// Explicitly look in the same path as where the main wx HINSTANCE module
|
||||
// is located (usually the executable or the DLL that uses wx). Normally
|
||||
// this is automatically part of the default search path but in some cases
|
||||
// it may not be, such as when the wxPython extension modules need to load
|
||||
// a DLL, but the intperpreter executable is located elsewhere. Doing
|
||||
// this allows us to always be able to dynamically load a DLL that is
|
||||
// located at the same place as the wx modules.
|
||||
wxString modpath, path;
|
||||
::GetModuleFileName(wxGetInstance(),
|
||||
wxStringBuffer(modpath, MAX_PATH+1),
|
||||
MAX_PATH);
|
||||
|
||||
wxFileName::SplitPath(modpath, &path, NULL, NULL);
|
||||
::SetDllDirectory(path.t_str());
|
||||
|
||||
wxDllType handle = ::LoadLibrary(libname.t_str());
|
||||
|
||||
// reset the search path
|
||||
::SetDllDirectory(NULL);
|
||||
return handle;
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
Reference in New Issue
Block a user