added wxDynamicLibrary::GetSymbolAorW()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35003 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -32,6 +32,7 @@ wxMSW:
|
|||||||
- Position of wxEVT_MOUSEWHEEL events is now in client, not screen, coordinates.
|
- Position of wxEVT_MOUSEWHEEL events is now in client, not screen, coordinates.
|
||||||
- Handle absence of wxListCtrl column image better (Zbigniew Zag<61>rski)
|
- Handle absence of wxListCtrl column image better (Zbigniew Zag<61>rski)
|
||||||
- Fixed asynchronous playback of large sound files in wxSound
|
- Fixed asynchronous playback of large sound files in wxSound
|
||||||
|
- Added wxDynamicLibrary::GetSymbolAorW()
|
||||||
|
|
||||||
wxWinCE:
|
wxWinCE:
|
||||||
|
|
||||||
|
@@ -103,6 +103,19 @@ contains no such symbol.
|
|||||||
\helpref{wxDYNLIB\_FUNCTION}{wxdynlibfunction}
|
\helpref{wxDYNLIB\_FUNCTION}{wxdynlibfunction}
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxDynamicLibrary::GetSymbolAorW}\label{wxdynamiclibrarygetsymbolaorw}
|
||||||
|
|
||||||
|
\constfunc{void *}{GetSymbolAorW}{\param{const wxString\& }{name}}
|
||||||
|
|
||||||
|
This function is available only under Windows as it is only useful when
|
||||||
|
dynamically loading symbols from standard Windows DLLs. Such functions have
|
||||||
|
either \texttt{'A'} (in ANSI build) or \texttt{'W'} (in Unicode, or wide
|
||||||
|
character build) suffix if they take string parameters. Using this function you
|
||||||
|
can use just the base name of the function and the correct suffix is appende
|
||||||
|
automatically depending on the current build. Otherwise, this method is
|
||||||
|
identical to \helpref{GetSymbol}{wxdynamiclibrarygetsymbol}.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxDynamicLibrary::GetProgramHandle}\label{wxdynamiclibrarygetprogramhandle}
|
\membersection{wxDynamicLibrary::GetProgramHandle}\label{wxdynamiclibrarygetprogramhandle}
|
||||||
|
|
||||||
\func{static wxDllType}{GetProgramHandle}{\void}
|
\func{static wxDllType}{GetProgramHandle}{\void}
|
||||||
|
@@ -245,6 +245,30 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
// this function is useful for loading functions from the standard Windows
|
||||||
|
// DLLs: such functions have an 'A' (in ANSI build) or 'W' (in Unicode, or
|
||||||
|
// wide character build) suffix if they take string parameters
|
||||||
|
static void *RawGetSymbolAorW(wxDllType handle, const wxString& name)
|
||||||
|
{
|
||||||
|
return RawGetSymbol
|
||||||
|
(
|
||||||
|
handle,
|
||||||
|
name +
|
||||||
|
#if wxUSE_UNICODE
|
||||||
|
L'W'
|
||||||
|
#else
|
||||||
|
'A'
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *GetSymbolAorW(const wxString& name) const
|
||||||
|
{
|
||||||
|
return RawGetSymbolAorW(m_handle, name);
|
||||||
|
}
|
||||||
|
#endif // __WXMSW__
|
||||||
|
|
||||||
// return all modules/shared libraries in the address space of this process
|
// return all modules/shared libraries in the address space of this process
|
||||||
//
|
//
|
||||||
// returns an empty array if not implemented or an error occurred
|
// returns an empty array if not implemented or an error occurred
|
||||||
|
@@ -53,7 +53,7 @@
|
|||||||
#define TEST_CMDLINE
|
#define TEST_CMDLINE
|
||||||
#define TEST_DATETIME
|
#define TEST_DATETIME
|
||||||
#define TEST_DIR
|
#define TEST_DIR
|
||||||
#define TEST_DLLLOADER
|
#define TEST_DYNLIB
|
||||||
#define TEST_ENVIRON
|
#define TEST_ENVIRON
|
||||||
#define TEST_EXECUTE
|
#define TEST_EXECUTE
|
||||||
#define TEST_FILE
|
#define TEST_FILE
|
||||||
@@ -85,7 +85,7 @@
|
|||||||
#define TEST_WCHAR
|
#define TEST_WCHAR
|
||||||
#define TEST_ZIP
|
#define TEST_ZIP
|
||||||
#else // #if TEST_ALL
|
#else // #if TEST_ALL
|
||||||
#define TEST_STACKWALKER
|
#define TEST_DYNLIB
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// some tests are interactive, define this to run them
|
// some tests are interactive, define this to run them
|
||||||
@@ -372,7 +372,7 @@ static void TestDirExists()
|
|||||||
// wxDllLoader
|
// wxDllLoader
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef TEST_DLLLOADER
|
#ifdef TEST_DYNLIB
|
||||||
|
|
||||||
#include "wx/dynlib.h"
|
#include "wx/dynlib.h"
|
||||||
|
|
||||||
@@ -398,7 +398,7 @@ static void TestDllLoad()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
typedef int (*wxStrlenType)(const char *);
|
typedef int (wxSTDCALL *wxStrlenType)(const char *);
|
||||||
wxStrlenType pfnStrlen = (wxStrlenType)lib.GetSymbol(FUNC_NAME);
|
wxStrlenType pfnStrlen = (wxStrlenType)lib.GetSymbol(FUNC_NAME);
|
||||||
if ( !pfnStrlen )
|
if ( !pfnStrlen )
|
||||||
{
|
{
|
||||||
@@ -419,6 +419,26 @@ static void TestDllLoad()
|
|||||||
wxPuts(_T("... ok"));
|
wxPuts(_T("... ok"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
static const wxChar *FUNC_NAME_AW = _T("lstrlen");
|
||||||
|
|
||||||
|
typedef int (wxSTDCALL *wxStrlenTypeAorW)(const wxChar *);
|
||||||
|
wxStrlenTypeAorW
|
||||||
|
pfnStrlenAorW = (wxStrlenTypeAorW)lib.GetSymbolAorW(FUNC_NAME_AW);
|
||||||
|
if ( !pfnStrlenAorW )
|
||||||
|
{
|
||||||
|
wxPrintf(_T("ERROR: function '%s' wasn't found in '%s'.\n"),
|
||||||
|
FUNC_NAME_AW, LIB_NAME);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( pfnStrlenAorW(_T("foobar")) != 6 )
|
||||||
|
{
|
||||||
|
wxPrintf(_T("ERROR: loaded function is not wxStrlen()!\n"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // __WXMSW__
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -450,7 +470,7 @@ static void TestDllListLoaded()
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // TEST_DLLLOADER
|
#endif // TEST_DYNLIB
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxGet/SetEnv
|
// wxGet/SetEnv
|
||||||
@@ -4119,10 +4139,10 @@ int main(int argc, char **argv)
|
|||||||
TestDirTraverse();
|
TestDirTraverse();
|
||||||
#endif // TEST_DIR
|
#endif // TEST_DIR
|
||||||
|
|
||||||
#ifdef TEST_DLLLOADER
|
#ifdef TEST_DYNLIB
|
||||||
TestDllLoad();
|
TestDllLoad();
|
||||||
TestDllListLoaded();
|
TestDllListLoaded();
|
||||||
#endif // TEST_DLLLOADER
|
#endif // TEST_DYNLIB
|
||||||
|
|
||||||
#ifdef TEST_ENVIRON
|
#ifdef TEST_ENVIRON
|
||||||
TestEnvironment();
|
TestEnvironment();
|
||||||
|
Reference in New Issue
Block a user