comparison src/loadso/os2/SDL_sysloadso.c @ 1662:782fd950bd46 SDL-1.3

Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API. WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid. The code is now run through a consistent indent format: indent -i4 -nut -nsc -br -ce The headers are being converted to automatically generate doxygen documentation.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 28 May 2006 13:04:16 +0000
parents 92947e3a18db
children 4da1ee79c9af
comparison
equal deleted inserted replaced
1661:281d3f4870e5 1662:782fd950bd46
31 #define INCL_DOSMODULEMGR 31 #define INCL_DOSMODULEMGR
32 #include <os2.h> 32 #include <os2.h>
33 33
34 #include "SDL_loadso.h" 34 #include "SDL_loadso.h"
35 35
36 void *SDL_LoadObject(const char *sofile) 36 void *
37 SDL_LoadObject (const char *sofile)
37 { 38 {
38 HMODULE handle = NULL; 39 HMODULE handle = NULL;
39 char buf[512]; 40 char buf[512];
40 APIRET ulrc = DosLoadModule(buf, sizeof (buf), (char *) sofile, &handle); 41 APIRET ulrc = DosLoadModule (buf, sizeof (buf), (char *) sofile, &handle);
41 42
42 /* Generate an error message if all loads failed */ 43 /* Generate an error message if all loads failed */
43 if ((ulrc != NO_ERROR) || (handle == NULL)) 44 if ((ulrc != NO_ERROR) || (handle == NULL))
44 SDL_SetError("Failed loading %s: %s", sofile, buf); 45 SDL_SetError ("Failed loading %s: %s", sofile, buf);
45 46
46 return((void *) handle); 47 return ((void *) handle);
47 } 48 }
48 49
49 void *SDL_LoadFunction(void *handle, const char *name) 50 void *
51 SDL_LoadFunction (void *handle, const char *name)
50 { 52 {
51 const char *loaderror = "Unknown error"; 53 const char *loaderror = "Unknown error";
52 void *symbol = NULL; 54 void *symbol = NULL;
53 APIRET ulrc = DosQueryProcAddr((HMODULE)handle, 0, (char *)name, &symbol); 55 APIRET ulrc =
56 DosQueryProcAddr ((HMODULE) handle, 0, (char *) name, &symbol);
54 if (ulrc == ERROR_INVALID_HANDLE) 57 if (ulrc == ERROR_INVALID_HANDLE)
55 loaderror = "Invalid module handle"; 58 loaderror = "Invalid module handle";
56 else if (ulrc == ERROR_INVALID_NAME) 59 else if (ulrc == ERROR_INVALID_NAME)
57 loaderror = "Symbol not found"; 60 loaderror = "Symbol not found";
58 61
59 if (symbol == NULL) 62 if (symbol == NULL)
60 SDL_SetError("Failed loading %s: %s", name, loaderror); 63 SDL_SetError ("Failed loading %s: %s", name, loaderror);
61 64
62 return(symbol); 65 return (symbol);
63 } 66 }
64 67
65 void SDL_UnloadObject(void *handle) 68 void
69 SDL_UnloadObject (void *handle)
66 { 70 {
67 if ( handle != NULL ) 71 if (handle != NULL)
68 DosFreeModule((HMODULE) handle); 72 DosFreeModule ((HMODULE) handle);
69 } 73 }
70 74
71 #endif /* SDL_LOADSO_OS2 */ 75 #endif /* SDL_LOADSO_OS2 */
76 /* vi: set ts=4 sw=4 expandtab: */