annotate src/loadso/windows/SDL_loadso.c @ 1291:31331c444ea2

Only save the window position if we're in windowed mode
author Sam Lantinga <slouken@libsdl.org>
date Sun, 29 Jan 2006 22:09:26 +0000
parents e9cf8c1b4590
children c9b51268668f
rev   line source
1173
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1 /*
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
3 Copyright (C) 1997-2004 Sam Lantinga
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
4
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
6 modify it under the terms of the GNU Library General Public
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
8 version 2 of the License, or (at your option) any later version.
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
9
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
13 Library General Public License for more details.
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
14
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
15 You should have received a copy of the GNU Library General Public
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
16 License along with this library; if not, write to the Free
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
18
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
19 Sam Lantinga
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
20 slouken@libsdl.org
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
21 */
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
22
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
23 #ifdef SAVE_RCSID
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
24 static char rcsid =
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
25 "@(#) $Id$";
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
26 #endif
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
27
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
28 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
29 /* System dependent library loading routines */
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
30
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
31 #if !SDL_INTERNAL_BUILDING_LOADSO
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
32 #error Do not compile directly...compile src/SDL_loadso.c instead!
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
33 #endif
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
34
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
35 #if !defined(WIN32) && !defined(_WIN32_WCE)
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
36 #error Compiling for the wrong platform?
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
37 #endif
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
38
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
39 #include <stdio.h>
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
40 #include <windows.h>
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
41
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
42 #include "SDL_types.h"
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
43 #include "SDL_error.h"
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
44 #include "SDL_loadso.h"
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
45
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
46 void *SDL_LoadObject(const char *sofile)
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
47 {
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
48 void *handle = NULL;
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
49 const char *loaderror = "Unknown error";
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
50
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
51 #if defined(_WIN32_WCE)
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
52 char errbuf[512];
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
53
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
54 wchar_t *errbuf_t = malloc(512 * sizeof(wchar_t));
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
55 wchar_t *sofile_t = malloc((MAX_PATH+1) * sizeof(wchar_t));
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
56
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
57 MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, sofile, -1, sofile_t, MAX_PATH);
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
58 handle = (void *)LoadLibrary(sofile_t);
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
59
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
60 /* Generate an error message if all loads failed */
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
61 if ( handle == NULL ) {
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
62 FormatMessage((FORMAT_MESSAGE_IGNORE_INSERTS |
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
63 FORMAT_MESSAGE_FROM_SYSTEM),
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
64 NULL, GetLastError(),
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
65 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
66 errbuf_t, SDL_TABLESIZE(errbuf), NULL);
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
67 WideCharToMultiByte(CP_ACP, 0, errbuf_t, -1, errbuf, 511, NULL, NULL);
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
68 loaderror = errbuf;
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
69 }
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
70
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
71 free(sofile_t);
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
72 free(errbuf_t);
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
73
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
74 #else /*if defined(WIN32)*/
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
75 char errbuf[512];
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
76
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
77 handle = (void *)LoadLibrary(sofile);
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
78
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
79 /* Generate an error message if all loads failed */
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
80 if ( handle == NULL ) {
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
81 FormatMessage((FORMAT_MESSAGE_IGNORE_INSERTS |
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
82 FORMAT_MESSAGE_FROM_SYSTEM),
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
83 NULL, GetLastError(),
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
84 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
85 errbuf, SDL_TABLESIZE(errbuf), NULL);
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
86 loaderror = errbuf;
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
87 }
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
88 #endif
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
89
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
90 if ( handle == NULL ) {
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
91 SDL_SetError("Failed loading %s: %s", sofile, loaderror);
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
92 }
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
93 return(handle);
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
94 }
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
95
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
96 void *SDL_LoadFunction(void *handle, const char *name)
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
97 {
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
98 void *symbol = NULL;
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
99 const char *loaderror = "Unknown error";
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
100
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
101 #if defined(_WIN32_WCE)
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
102 char errbuf[512];
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
103 int length = strlen(name);
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
104
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
105 wchar_t *name_t = malloc((length + 1) * sizeof(wchar_t));
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
106 wchar_t *errbuf_t = malloc(512 * sizeof(wchar_t));
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
107
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
108 MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, name, -1, name_t, length);
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
109
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
110 symbol = (void *)GetProcAddress((HMODULE)handle, name_t);
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
111 if ( symbol == NULL ) {
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
112 FormatMessage((FORMAT_MESSAGE_IGNORE_INSERTS |
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
113 FORMAT_MESSAGE_FROM_SYSTEM),
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
114 NULL, GetLastError(),
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
115 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
116 errbuf_t, SDL_TABLESIZE(errbuf), NULL);
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
117 WideCharToMultiByte(CP_ACP, 0, errbuf_t, -1, errbuf, 511, NULL, NULL);
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
118 loaderror = errbuf;
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
119 }
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
120
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
121 free(name_t);
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
122 free(errbuf_t);
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
123
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
124 #else /*if defined(WIN32)*/
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
125 char errbuf[512];
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
126
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
127 symbol = (void *)GetProcAddress((HMODULE)handle, name);
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
128 if ( symbol == NULL ) {
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
129 FormatMessage((FORMAT_MESSAGE_IGNORE_INSERTS |
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
130 FORMAT_MESSAGE_FROM_SYSTEM),
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
131 NULL, GetLastError(),
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
132 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
133 errbuf, SDL_TABLESIZE(errbuf), NULL);
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
134 loaderror = errbuf;
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
135 }
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
136 #endif
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
137
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
138 if ( symbol == NULL ) {
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
139 SDL_SetError("Failed loading %s: %s", name, loaderror);
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
140 }
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
141 return(symbol);
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
142 }
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
143
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
144 void SDL_UnloadObject(void *handle)
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
145 {
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
146 if ( handle != NULL ) {
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
147 FreeLibrary((HMODULE)handle);
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
148 }
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
149 }
e9cf8c1b4590 Split up src/SDL_loadso.c into platform directories.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
150