X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ced3df773028534651ef358ae692affdbf3f9aaf..69357fa0cb9bacb2c537837d27f11883a82b2425:/include/wx/dynlib.h diff --git a/include/wx/dynlib.h b/include/wx/dynlib.h index 88e58a7c73..6f842edb17 100644 --- a/include/wx/dynlib.h +++ b/include/wx/dynlib.h @@ -106,6 +106,24 @@ enum wxPluginCategory type pfn ## name = (type)(dynlib).GetSymbol(_T(#name)) +// a more convenient function replacing wxDYNLIB_FUNCTION above +// +// it uses the convention that the type of the function is its name suffixed +// with "_t" but it doesn't define a variable but just assigns the loaded value +// to it and also allows to pass it the prefix to be used instead of hardcoding +// "pfn" (the prefix can be "m_" or "gs_pfn" or whatever) +#define wxDL_INIT_FUNC(pfx, name, dynlib) \ + pfx ## name = (name ## _t)(dynlib).GetSymbol(#name) + +#ifdef __WXMSW__ + +// same as wxDL_INIT_FUNC() but appends 'A' or 'W' to the function name, see +// wxDynamicLibrary::GetSymbolAorW() +#define wxDL_INIT_FUNC_AW(pfx, name, dynlib) \ + pfx ## name = (name ## _t)(dynlib).GetSymbolAorW(#name) + +#endif // __WXMSW__ + // the following macros can be used to redirect a whole library to a class and // check at run-time if the library is present and contains all required // methods