Mercurial > sdl-ios-xcode
comparison src/SDL_loadso.c @ 1152:51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
activekitten.com.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Thu, 29 Sep 2005 09:43:00 +0000 |
parents | cf6133247d34 |
children | e9cf8c1b4590 |
comparison
equal
deleted
inserted
replaced
1151:be9c9c8f6d53 | 1152:51a8702d8ecd |
---|---|
29 /* System dependent library loading routines */ | 29 /* System dependent library loading routines */ |
30 | 30 |
31 #include <stdio.h> | 31 #include <stdio.h> |
32 #if defined(USE_DLOPEN) | 32 #if defined(USE_DLOPEN) |
33 # include <dlfcn.h> | 33 # include <dlfcn.h> |
34 #elif defined(WIN32) | 34 #elif defined(WIN32) || defined(_WIN32_WCE) |
35 # include <windows.h> | 35 # include <windows.h> |
36 #elif defined(__BEOS__) | 36 #elif defined(__BEOS__) |
37 # include <be/kernel/image.h> | 37 # include <be/kernel/image.h> |
38 #elif defined(macintosh) | 38 #elif defined(macintosh) |
39 # include <string.h> | 39 # include <string.h> |
58 const char *loaderror = "SDL_LoadObject() not implemented"; | 58 const char *loaderror = "SDL_LoadObject() not implemented"; |
59 #if defined(USE_DLOPEN) | 59 #if defined(USE_DLOPEN) |
60 /* * */ | 60 /* * */ |
61 handle = dlopen(sofile, RTLD_NOW); | 61 handle = dlopen(sofile, RTLD_NOW); |
62 loaderror = (char *)dlerror(); | 62 loaderror = (char *)dlerror(); |
63 #elif defined(_WIN32_WCE) | |
64 /* * */ | |
65 char errbuf[512]; | |
66 | |
67 wchar_t *errbuf_t = malloc(512 * sizeof(wchar_t)); | |
68 wchar_t *sofile_t = malloc((MAX_PATH+1) * sizeof(wchar_t)); | |
69 | |
70 MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, sofile, -1, sofile_t, MAX_PATH); | |
71 handle = (void *)LoadLibrary(sofile_t); | |
72 | |
73 /* Generate an error message if all loads failed */ | |
74 if ( handle == NULL ) { | |
75 FormatMessage((FORMAT_MESSAGE_IGNORE_INSERTS | | |
76 FORMAT_MESSAGE_FROM_SYSTEM), | |
77 NULL, GetLastError(), | |
78 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), | |
79 errbuf_t, SDL_TABLESIZE(errbuf), NULL); | |
80 WideCharToMultiByte(CP_ACP, 0, errbuf_t, -1, errbuf, 511, NULL, NULL); | |
81 loaderror = errbuf; | |
82 } | |
83 | |
84 free(sofile_t); | |
85 free(errbuf_t); | |
86 | |
63 #elif defined(WIN32) | 87 #elif defined(WIN32) |
64 /* * */ | 88 /* * */ |
65 char errbuf[512]; | 89 char errbuf[512]; |
66 | 90 |
67 handle = (void *)LoadLibrary(sofile); | 91 handle = (void *)LoadLibrary(sofile); |
137 /* * */ | 161 /* * */ |
138 symbol = dlsym(handle, name); | 162 symbol = dlsym(handle, name); |
139 if ( symbol == NULL ) { | 163 if ( symbol == NULL ) { |
140 loaderror = (char *)dlerror(); | 164 loaderror = (char *)dlerror(); |
141 } | 165 } |
166 #elif defined(_WIN32_WCE) | |
167 /* * */ | |
168 char errbuf[512]; | |
169 int length = strlen(name); | |
170 | |
171 wchar_t *name_t = malloc((length + 1) * sizeof(wchar_t)); | |
172 wchar_t *errbuf_t = malloc(512 * sizeof(wchar_t)); | |
173 | |
174 MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, name, -1, name_t, length); | |
175 | |
176 symbol = (void *)GetProcAddress((HMODULE)handle, name_t); | |
177 if ( symbol == NULL ) { | |
178 FormatMessage((FORMAT_MESSAGE_IGNORE_INSERTS | | |
179 FORMAT_MESSAGE_FROM_SYSTEM), | |
180 NULL, GetLastError(), | |
181 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), | |
182 errbuf_t, SDL_TABLESIZE(errbuf), NULL); | |
183 WideCharToMultiByte(CP_ACP, 0, errbuf_t, -1, errbuf, 511, NULL, NULL); | |
184 loaderror = errbuf; | |
185 } | |
186 | |
187 free(name_t); | |
188 free(errbuf_t); | |
189 | |
142 #elif defined(WIN32) | 190 #elif defined(WIN32) |
143 /* * */ | 191 /* * */ |
144 char errbuf[512]; | 192 char errbuf[512]; |
145 | 193 |
146 symbol = (void *)GetProcAddress((HMODULE)handle, name); | 194 symbol = (void *)GetProcAddress((HMODULE)handle, name); |