本文整理汇总了C++中SDL_UnloadObject函数的典型用法代码示例。如果您正苦于以下问题:C++ SDL_UnloadObject函数的具体用法?C++ SDL_UnloadObject怎么用?C++ SDL_UnloadObject使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SDL_UnloadObject函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: X11_Vulkan_UnloadLibrary
void X11_Vulkan_UnloadLibrary(_THIS)
{
SDL_VideoData *videoData = (SDL_VideoData *)_this->driverdata;
if(_this->vulkan_config.loader_handle)
{
if(videoData->vulkan_xlib_xcb_library)
SDL_UnloadObject(videoData->vulkan_xlib_xcb_library);
SDL_UnloadObject(_this->vulkan_config.loader_handle);
_this->vulkan_config.loader_handle = NULL;
}
}
示例2: UnloadALSALibrary
static void UnloadALSALibrary(void) {
if (alsa_loaded) {
SDL_UnloadObject(alsa_handle);
alsa_handle = NULL;
alsa_loaded = 0;
}
}
示例3: unloadPlugin
void unloadPlugin() {
DynamicPlugin::unloadPlugin();
if (_dlHandle) {
SDL_UnloadObject(_dlHandle);
_dlHandle = 0;
}
}
示例4: DXGI_LoadDLL
SDL_bool
DXGI_LoadDLL( void **pDXGIDLL , IDXGIFactory **pDXGIFactory )
{
*pDXGIDLL = SDL_LoadObject("DXGI.DLL");
if (*pDXGIDLL ) {
HRESULT (WINAPI *CreateDXGI)( REFIID riid, void **ppFactory );
CreateDXGI =
(HRESULT (WINAPI *) (REFIID, void**)) SDL_LoadFunction(*pDXGIDLL,
"CreateDXGIFactory");
if (CreateDXGI) {
GUID dxgiGUID = {0x7b7166ec,0x21c7,0x44ae,{0xb2,0x1a,0xc9,0xae,0x32,0x1a,0xe3,0x69}};
if( !SUCCEEDED( CreateDXGI( &dxgiGUID, (void**)pDXGIFactory ))) {
*pDXGIFactory = NULL;
}
}
if (!*pDXGIFactory) {
SDL_UnloadObject(*pDXGIDLL);
*pDXGIDLL = NULL;
return SDL_FALSE;
}
return SDL_TRUE;
} else {
*pDXGIFactory = NULL;
return SDL_FALSE;
}
}
示例5: D3D_DestroyRenderer
static void
D3D_DestroyRenderer(SDL_Renderer * renderer)
{
D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
if (data) {
/* Release the render target */
if (data->defaultRenderTarget) {
IDirect3DSurface9_Release(data->defaultRenderTarget);
data->defaultRenderTarget = NULL;
}
if (data->currentRenderTarget != NULL) {
IDirect3DSurface9_Release(data->currentRenderTarget);
data->currentRenderTarget = NULL;
}
if (data->device) {
IDirect3DDevice9_Release(data->device);
}
if (data->d3d) {
IDirect3D9_Release(data->d3d);
ID3DXMatrixStack_Release(data->matrixStack);
SDL_UnloadObject(data->d3dDLL);
}
SDL_free(data);
}
SDL_free(renderer);
}
示例6: WIN_DeleteDevice
static void
WIN_DeleteDevice(SDL_VideoDevice * device)
{
SDL_VideoData *data = (SDL_VideoData *) device->driverdata;
SDL_UnregisterApp();
if (data->userDLL) {
SDL_UnloadObject(data->userDLL);
}
if (data->shcoreDLL) {
SDL_UnloadObject(data->shcoreDLL);
}
SDL_free(device->driverdata);
SDL_free(device);
}
示例7: SDL_X11_UnloadSymbols
void
SDL_X11_UnloadSymbols(void)
{
/* Don't actually unload if more than one module is using the libs... */
if (x11_load_refcount > 0) {
if (--x11_load_refcount == 0) {
int i;
/* set all the function pointers to NULL. */
#define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 0;
#define SDL_X11_SYM(rc,fn,params,args,ret) X11_##fn = NULL;
#include "SDL_x11sym.h"
#ifdef X_HAVE_UTF8_STRING
X11_XCreateIC = NULL;
X11_XGetICValues = NULL;
#endif
#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC
for (i = 0; i < SDL_TABLESIZE(x11libs); i++) {
if (x11libs[i].lib != NULL) {
SDL_UnloadObject(x11libs[i].lib);
x11libs[i].lib = NULL;
}
}
#endif
}
}
}
示例8: SDL_WAYLAND_UnloadSymbols
void
SDL_WAYLAND_UnloadSymbols(void)
{
/* Don't actually unload if more than one module is using the libs... */
if (wayland_load_refcount > 0) {
if (--wayland_load_refcount == 0) {
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
int i;
#endif
/* set all the function pointers to NULL. */
#define SDL_WAYLAND_MODULE(modname) SDL_WAYLAND_HAVE_##modname = 0;
#define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = NULL;
#define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = NULL;
#include "SDL_waylandsym.h"
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
for (i = 0; i < SDL_TABLESIZE(waylandlibs); i++) {
if (waylandlibs[i].lib != NULL) {
SDL_UnloadObject(waylandlibs[i].lib);
waylandlibs[i].lib = NULL;
}
}
#endif
}
}
}
示例9: SDL_MIR_UnloadSymbols
void
SDL_MIR_UnloadSymbols(void)
{
/* Don't actually unload if more than one module is using the libs... */
if (mir_load_refcount > 0) {
if (--mir_load_refcount == 0) {
#ifdef SDL_VIDEO_DRIVER_MIR_DYNAMIC
int i;
#endif
/* set all the function pointers to NULL. */
#define SDL_MIR_MODULE(modname) SDL_MIR_HAVE_##modname = 0;
#define SDL_MIR_SYM(rc,fn,params) MIR_##fn = NULL;
#include "SDL_mirsym.h"
#undef SDL_MIR_MODULE
#undef SDL_MIR_SYM
#ifdef SDL_VIDEO_DRIVER_MIR_DYNAMIC
for (i = 0; i < SDL_TABLESIZE(mirlibs); i++) {
if (mirlibs[i].lib != NULL) {
SDL_UnloadObject(mirlibs[i].lib);
mirlibs[i].lib = NULL;
}
}
#endif
}
}
}
示例10: SDL_UnloadObject
PluginManager::~PluginManager()
{
for (void* p : _plugins)
{
SDL_UnloadObject(p);
}
}
示例11: CallNoArgNotification
/** Calls a function with no args and no return value in the specified DLL */
void CallNoArgNotification( const char *pchModuleName, const char *pchProcName )
{
#if defined(_WIN32)
void * pMod = (void *)GetModuleHandle( pchModuleName );
if( pMod )
{
NoArgNotificationFn_t fn = (NoArgNotificationFn_t)SDL_LoadFunction( pMod, pchProcName );
#elif defined(POSIX)
// on POSIX there is no reasonable way to get the handle of a module without the
// full path name. Since we don't know that, just assume that the global symbol
// name is only defined in the right module
NoArgNotificationFn_t fn = (NoArgNotificationFn_t)SDL_LoadFunction( NULL, pchProcName );
#endif
if( fn )
{
// actually call the function
fn();
}
#if defined(_WIN32)
// unload the module to free up the reference that was returned by SDL_GetLoadedObject
SDL_UnloadObject( pMod );
}
#endif
}
示例12: D3D_LoadDLL
SDL_bool
D3D_LoadDLL( void **pD3DDLL, IDirect3D9 **pDirect3D9Interface )
{
*pD3DDLL = SDL_LoadObject("D3D9.DLL");
if (*pD3DDLL) {
IDirect3D9 *(WINAPI * D3DCreate) (UINT SDKVersion);
D3DCreate =
(IDirect3D9 * (WINAPI *) (UINT)) SDL_LoadFunction(*pD3DDLL,
"Direct3DCreate9");
if (D3DCreate) {
*pDirect3D9Interface = D3DCreate(D3D_SDK_VERSION);
}
if (!*pDirect3D9Interface) {
SDL_UnloadObject(*pD3DDLL);
*pD3DDLL = NULL;
return SDL_FALSE;
}
return SDL_TRUE;
} else {
*pDirect3D9Interface = NULL;
return SDL_FALSE;
}
}
示例13: IMG_InitTIF
int IMG_InitTIF()
{
if ( lib.loaded == 0 ) {
lib.handle = SDL_LoadObject(LOAD_TIF_DYNAMIC);
if ( lib.handle == NULL ) {
return -1;
}
lib.TIFFClientOpen =
(TIFF* (*)(const char*, const char*, thandle_t, TIFFReadWriteProc, TIFFReadWriteProc, TIFFSeekProc, TIFFCloseProc, TIFFSizeProc, TIFFMapFileProc, TIFFUnmapFileProc))
SDL_LoadFunction(lib.handle, "TIFFClientOpen");
if ( lib.TIFFClientOpen == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
lib.TIFFClose =
(void (*)(TIFF*))
SDL_LoadFunction(lib.handle, "TIFFClose");
if ( lib.TIFFClose == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
lib.TIFFGetField =
(int (*)(TIFF*, ttag_t, ...))
SDL_LoadFunction(lib.handle, "TIFFGetField");
if ( lib.TIFFGetField == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
lib.TIFFReadRGBAImage =
(int (*)(TIFF*, uint32, uint32, uint32*, int))
SDL_LoadFunction(lib.handle, "TIFFReadRGBAImage");
if ( lib.TIFFReadRGBAImage == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
lib.TIFFSetErrorHandler =
(TIFFErrorHandler (*)(TIFFErrorHandler))
SDL_LoadFunction(lib.handle, "TIFFSetErrorHandler");
if ( lib.TIFFSetErrorHandler == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
}
++lib.loaded;
return 0;
}
示例14: main
int
main(int argc, char *argv[])
{
int retval = 0;
int hello = 0;
const char *libname = NULL;
const char *symname = NULL;
void *lib = NULL;
fntype fn = NULL;
if (argc != 3) {
const char *app = argv[0];
SDL_Log("USAGE: %s <library> <functionname>\n", app);
SDL_Log(" %s --hello <lib with puts()>\n", app);
return 1;
}
/* Initialize SDL */
if (SDL_Init(0) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
return 2;
}
if (strcmp(argv[1], "--hello") == 0) {
hello = 1;
libname = argv[2];
symname = "puts";
} else {
libname = argv[1];
symname = argv[2];
}
lib = SDL_LoadObject(libname);
if (lib == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_LoadObject('%s') failed: %s\n",
libname, SDL_GetError());
retval = 3;
} else {
fn = (fntype) SDL_LoadFunction(lib, symname);
if (fn == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_LoadFunction('%s') failed: %s\n",
symname, SDL_GetError());
retval = 4;
} else {
SDL_Log("Found %s in %s at %p\n", symname, libname, fn);
if (hello) {
SDL_Log("Calling function...\n");
fflush(stdout);
fn(" HELLO, WORLD!\n");
SDL_Log("...apparently, we survived. :)\n");
SDL_Log("Unloading library...\n");
fflush(stdout);
}
}
SDL_UnloadObject(lib);
}
SDL_Quit();
return retval;
}
示例15: WIN_GL_LoadLibrary
int
WIN_GL_LoadLibrary(_THIS, const char *path)
{
LPTSTR wpath;
HANDLE handle;
if (path == NULL) {
path = SDL_getenv("SDL_OPENGL_LIBRARY");
}
if (path == NULL) {
path = DEFAULT_OPENGL;
}
wpath = WIN_UTF8ToString(path);
_this->gl_config.dll_handle = LoadLibrary(wpath);
SDL_free(wpath);
if (!_this->gl_config.dll_handle) {
char message[1024];
SDL_snprintf(message, SDL_arraysize(message), "LoadLibrary(\"%s\")",
path);
WIN_SetError(message);
return -1;
}
SDL_strlcpy(_this->gl_config.driver_path, path,
SDL_arraysize(_this->gl_config.driver_path));
/* Allocate OpenGL memory */
_this->gl_data =
(struct SDL_GLDriverData *) SDL_calloc(1,
sizeof(struct
SDL_GLDriverData));
if (!_this->gl_data) {
SDL_OutOfMemory();
return -1;
}
/* Load function pointers */
handle = _this->gl_config.dll_handle;
_this->gl_data->wglGetProcAddress = (void *(WINAPI *) (const char *))
GetProcAddress(handle, "wglGetProcAddress");
_this->gl_data->wglCreateContext = (HGLRC(WINAPI *) (HDC))
GetProcAddress(handle, "wglCreateContext");
_this->gl_data->wglDeleteContext = (BOOL(WINAPI *) (HGLRC))
GetProcAddress(handle, "wglDeleteContext");
_this->gl_data->wglMakeCurrent = (BOOL(WINAPI *) (HDC, HGLRC))
GetProcAddress(handle, "wglMakeCurrent");
_this->gl_data->wglShareLists = (BOOL(WINAPI *) (HGLRC, HGLRC))
GetProcAddress(handle, "wglShareLists");
if (!_this->gl_data->wglGetProcAddress ||
!_this->gl_data->wglCreateContext ||
!_this->gl_data->wglDeleteContext ||
!_this->gl_data->wglMakeCurrent) {
SDL_SetError("Could not retrieve OpenGL functions");
SDL_UnloadObject(handle);
return -1;
}
return 0;
}