1 
2 //          Copyright Michael D. Parker 2018.
3 // Distributed under the Boost Software License, Version 1.0.
4 //    (See accompanying file LICENSE_1_0.txt or copy at
5 //          http://www.boost.org/LICENSE_1_0.txt)
6 
7 module bindbc.sdl.dynload;
8 
9 version(BindBC_Static) {}
10 else version(BindSDL_Static) {}
11 else:
12 
13 import bindbc.loader;
14 import bindbc.sdl.config,
15        bindbc.sdl.bind;
16 
17 private {
18     SharedLib lib;
19     SDLSupport loadedVersion;
20 }
21 
22 void unloadSDL()
23 {
24     if(lib != invalidHandle) {
25         lib.unload();
26     }
27 }
28 
29 SDLSupport loadedSDLVersion() { return loadedVersion; }
30 
31 bool isSDLLoaded()
32 {
33     return  lib != invalidHandle;
34 }
35 
36 SDLSupport loadSDL()
37 {
38     // #1778 prevents me from using static arrays here :(
39     version(Windows) {
40         const(char)[][1] libNames = ["SDL2.dll"];
41     }
42     else version(OSX) {
43         const(char)[][7] libNames = [
44             "libSDL2.dylib",
45             "/usr/local/lib/libSDL2.dylib",
46             "/usr/local/lib/libSDL2/libSDL2.dylib",
47             "../Frameworks/SDL2.framework/SDL2",
48             "/Library/Frameworks/SDL2.framework/SDL2",
49             "/System/Library/Frameworks/SDL2.framework/SDL2",
50             "/opt/local/lib/libSDL2.dylib"
51         ];
52     }
53     else version(Posix) {
54         const(char)[][6] libNames = [
55             "libSDL2.so",
56             "/usr/local/lib/libSDL2.so",
57             "libSDL2-2.0.so",
58             "/usr/local/lib/libSDL2-2.0.so",
59             "libSDL2-2.0.so.0",
60             "/usr/local/lib/libSDL2-2.0.so.0"
61         ];
62     }
63     else static assert(0, "bindbc-sdl is not yet supported on this platform.");
64 
65     SDLSupport ret;
66     foreach(name; libNames) {
67         ret = loadSDL(name.ptr);
68         if(ret != SDLSupport.noLibrary) break;
69     }
70     return ret;
71 }
72 
73 SDLSupport loadSDL(const(char)* libName)
74 {
75     lib = load(libName);
76     if(lib == invalidHandle) {
77         return SDLSupport.noLibrary;
78     }
79 
80     auto errCount = errorCount();
81     loadedVersion = SDLSupport.badLibrary;
82 
83     lib.bindSymbol(cast(void**)&SDL_Init, "SDL_Init");
84     lib.bindSymbol(cast(void**)&SDL_InitSubSystem, "SDL_InitSubSystem");
85     lib.bindSymbol(cast(void**)&SDL_QuitSubSystem, "SDL_QuitSubSystem");
86     lib.bindSymbol(cast(void**)&SDL_WasInit, "SDL_WasInit");
87     lib.bindSymbol(cast(void**)&SDL_Quit, "SDL_Quit");
88     lib.bindSymbol(cast(void**)&SDL_SetAssertionHandler, "SDL_SetAssertionHandler");
89     lib.bindSymbol(cast(void**)&SDL_GetAssertionReport, "SDL_GetAssertionReport");
90     lib.bindSymbol(cast(void**)&SDL_ResetAssertionReport, "SDL_ResetAssertionReport");
91     lib.bindSymbol(cast(void**)&SDL_AtomicCAS, "SDL_AtomicCAS");
92     lib.bindSymbol(cast(void**)&SDL_AtomicCASPtr, "SDL_AtomicCASPtr");
93     lib.bindSymbol(cast(void**)&SDL_GetNumAudioDrivers, "SDL_GetNumAudioDrivers");
94     lib.bindSymbol(cast(void**)&SDL_GetAudioDriver, "SDL_GetAudioDriver");
95     lib.bindSymbol(cast(void**)&SDL_AudioInit, "SDL_AudioInit");
96     lib.bindSymbol(cast(void**)&SDL_AudioQuit, "SDL_AudioQuit");
97     lib.bindSymbol(cast(void**)&SDL_GetCurrentAudioDriver, "SDL_GetCurrentAudioDriver");
98     lib.bindSymbol(cast(void**)&SDL_OpenAudio, "SDL_OpenAudio");
99     lib.bindSymbol(cast(void**)&SDL_GetNumAudioDevices, "SDL_GetNumAudioDevices");
100     lib.bindSymbol(cast(void**)&SDL_GetAudioDeviceName, "SDL_GetAudioDeviceName");
101     lib.bindSymbol(cast(void**)&SDL_OpenAudioDevice, "SDL_OpenAudioDevice");
102     lib.bindSymbol(cast(void**)&SDL_GetAudioStatus, "SDL_GetAudioStatus");
103     lib.bindSymbol(cast(void**)&SDL_GetAudioDeviceStatus, "SDL_GetAudioDeviceStatus");
104     lib.bindSymbol(cast(void**)&SDL_PauseAudio, "SDL_PauseAudio");
105     lib.bindSymbol(cast(void**)&SDL_PauseAudioDevice, "SDL_PauseAudioDevice");
106     lib.bindSymbol(cast(void**)&SDL_LoadWAV_RW, "SDL_LoadWAV_RW");
107     lib.bindSymbol(cast(void**)&SDL_FreeWAV, "SDL_FreeWAV");
108     lib.bindSymbol(cast(void**)&SDL_BuildAudioCVT, "SDL_BuildAudioCVT");
109     lib.bindSymbol(cast(void**)&SDL_ConvertAudio, "SDL_ConvertAudio");
110     lib.bindSymbol(cast(void**)&SDL_MixAudio, "SDL_MixAudio");
111     lib.bindSymbol(cast(void**)&SDL_MixAudioFormat, "SDL_MixAudioFormat");
112     lib.bindSymbol(cast(void**)&SDL_LockAudio, "SDL_LockAudio");
113     lib.bindSymbol(cast(void**)&SDL_LockAudioDevice, "SDL_LockAudioDevice");
114     lib.bindSymbol(cast(void**)&SDL_UnlockAudio, "SDL_UnlockAudio");
115     lib.bindSymbol(cast(void**)&SDL_UnlockAudioDevice, "SDL_UnlockAudioDevice");
116     lib.bindSymbol(cast(void**)&SDL_CloseAudio, "SDL_CloseAudio");
117     lib.bindSymbol(cast(void**)&SDL_CloseAudioDevice, "SDL_CloseAudioDevice");
118     lib.bindSymbol(cast(void**)&SDL_SetClipboardText, "SDL_SetClipboardText");
119     lib.bindSymbol(cast(void**)&SDL_GetClipboardText, "SDL_GetClipboardText");
120     lib.bindSymbol(cast(void**)&SDL_HasClipboardText, "SDL_HasClipboardText");
121     lib.bindSymbol(cast(void**)&SDL_GetCPUCount, "SDL_GetCPUCount");
122     lib.bindSymbol(cast(void**)&SDL_GetCPUCacheLineSize, "SDL_GetCPUCacheLineSize");
123     lib.bindSymbol(cast(void**)&SDL_HasRDTSC, "SDL_HasRDTSC");
124     lib.bindSymbol(cast(void**)&SDL_HasAltiVec, "SDL_HasAltiVec");
125     lib.bindSymbol(cast(void**)&SDL_HasMMX, "SDL_HasMMX");
126     lib.bindSymbol(cast(void**)&SDL_Has3DNow, "SDL_Has3DNow");
127     lib.bindSymbol(cast(void**)&SDL_HasSSE, "SDL_HasSSE");
128     lib.bindSymbol(cast(void**)&SDL_HasSSE2, "SDL_HasSSE2");
129     lib.bindSymbol(cast(void**)&SDL_HasSSE3, "SDL_HasSSE3");
130     lib.bindSymbol(cast(void**)&SDL_HasSSE41, "SDL_HasSSE41");
131     lib.bindSymbol(cast(void**)&SDL_HasSSE42, "SDL_HasSSE42");
132     lib.bindSymbol(cast(void**)&SDL_SetError, "SDL_SetError");
133     lib.bindSymbol(cast(void**)&SDL_GetError, "SDL_GetError");
134     lib.bindSymbol(cast(void**)&SDL_ClearError, "SDL_ClearError");
135     lib.bindSymbol(cast(void**)&SDL_PumpEvents, "SDL_PumpEvents");
136     lib.bindSymbol(cast(void**)&SDL_PeepEvents, "SDL_PeepEvents");
137     lib.bindSymbol(cast(void**)&SDL_HasEvent, "SDL_HasEvent");
138     lib.bindSymbol(cast(void**)&SDL_HasEvents, "SDL_HasEvents");
139     lib.bindSymbol(cast(void**)&SDL_FlushEvent, "SDL_FlushEvent");
140     lib.bindSymbol(cast(void**)&SDL_FlushEvents, "SDL_FlushEvents");
141     lib.bindSymbol(cast(void**)&SDL_PollEvent, "SDL_PollEvent");
142     lib.bindSymbol(cast(void**)&SDL_WaitEvent, "SDL_WaitEvent");
143     lib.bindSymbol(cast(void**)&SDL_WaitEventTimeout, "SDL_WaitEventTimeout");
144     lib.bindSymbol(cast(void**)&SDL_PushEvent, "SDL_PushEvent");
145     lib.bindSymbol(cast(void**)&SDL_SetEventFilter, "SDL_SetEventFilter");
146     lib.bindSymbol(cast(void**)&SDL_GetEventFilter, "SDL_GetEventFilter");
147     lib.bindSymbol(cast(void**)&SDL_AddEventWatch, "SDL_AddEventWatch");
148     lib.bindSymbol(cast(void**)&SDL_DelEventWatch, "SDL_DelEventWatch");
149     lib.bindSymbol(cast(void**)&SDL_FilterEvents, "SDL_FilterEvents");
150     lib.bindSymbol(cast(void**)&SDL_EventState, "SDL_EventState");
151     lib.bindSymbol(cast(void**)&SDL_RegisterEvents, "SDL_RegisterEvents");
152     lib.bindSymbol(cast(void**)&SDL_GameControllerAddMapping, "SDL_GameControllerAddMapping");
153     lib.bindSymbol(cast(void**)&SDL_GameControllerMappingForGUID, "SDL_GameControllerMappingForGUID");
154     lib.bindSymbol(cast(void**)&SDL_GameControllerMapping, "SDL_GameControllerMapping");
155     lib.bindSymbol(cast(void**)&SDL_IsGameController, "SDL_IsGameController");
156     lib.bindSymbol(cast(void**)&SDL_GameControllerNameForIndex, "SDL_GameControllerNameForIndex");
157     lib.bindSymbol(cast(void**)&SDL_GameControllerOpen, "SDL_GameControllerOpen");
158     lib.bindSymbol(cast(void**)&SDL_GameControllerName, "SDL_GameControllerName");
159     lib.bindSymbol(cast(void**)&SDL_GameControllerGetAttached, "SDL_GameControllerGetAttached");
160     lib.bindSymbol(cast(void**)&SDL_GameControllerGetJoystick, "SDL_GameControllerGetJoystick");
161     lib.bindSymbol(cast(void**)&SDL_GameControllerEventState, "SDL_GameControllerEventState");
162     lib.bindSymbol(cast(void**)&SDL_GameControllerUpdate, "SDL_GameControllerUpdate");
163     lib.bindSymbol(cast(void**)&SDL_GameControllerGetAxisFromString, "SDL_GameControllerGetAxisFromString");
164     lib.bindSymbol(cast(void**)&SDL_GameControllerGetStringForAxis, "SDL_GameControllerGetStringForAxis");
165     lib.bindSymbol(cast(void**)&SDL_GameControllerGetBindForAxis, "SDL_GameControllerGetBindForAxis");
166     lib.bindSymbol(cast(void**)&SDL_GameControllerGetAxis, "SDL_GameControllerGetAxis");
167     lib.bindSymbol(cast(void**)&SDL_GameControllerGetButtonFromString, "SDL_GameControllerGetButtonFromString");
168     lib.bindSymbol(cast(void**)&SDL_GameControllerGetStringForButton, "SDL_GameControllerGetStringForButton");
169     lib.bindSymbol(cast(void**)&SDL_GameControllerGetBindForButton, "SDL_GameControllerGetBindForButton");
170     lib.bindSymbol(cast(void**)&SDL_GameControllerGetButton, "SDL_GameControllerGetButton");
171     lib.bindSymbol(cast(void**)&SDL_GameControllerClose, "SDL_GameControllerClose");
172     lib.bindSymbol(cast(void**)&SDL_RecordGesture, "SDL_RecordGesture");
173     lib.bindSymbol(cast(void**)&SDL_SaveAllDollarTemplates, "SDL_SaveAllDollarTemplates");
174     lib.bindSymbol(cast(void**)&SDL_SaveDollarTemplate, "SDL_SaveDollarTemplate");
175     lib.bindSymbol(cast(void**)&SDL_LoadDollarTemplates, "SDL_LoadDollarTemplates");
176     lib.bindSymbol(cast(void**)&SDL_NumHaptics, "SDL_NumHaptics");
177     lib.bindSymbol(cast(void**)&SDL_HapticName, "SDL_HapticName");
178     lib.bindSymbol(cast(void**)&SDL_HapticOpen, "SDL_HapticOpen");
179     lib.bindSymbol(cast(void**)&SDL_HapticOpened, "SDL_HapticOpened");
180     lib.bindSymbol(cast(void**)&SDL_HapticIndex, "SDL_HapticIndex");
181     lib.bindSymbol(cast(void**)&SDL_MouseIsHaptic, "SDL_MouseIsHaptic");
182     lib.bindSymbol(cast(void**)&SDL_HapticOpenFromMouse, "SDL_HapticOpenFromMouse");
183     lib.bindSymbol(cast(void**)&SDL_JoystickIsHaptic, "SDL_JoystickIsHaptic");
184     lib.bindSymbol(cast(void**)&SDL_HapticOpenFromJoystick, "SDL_HapticOpenFromJoystick");
185     lib.bindSymbol(cast(void**)&SDL_HapticClose, "SDL_HapticClose");
186     lib.bindSymbol(cast(void**)&SDL_HapticNumEffects, "SDL_HapticNumEffects");
187     lib.bindSymbol(cast(void**)&SDL_HapticNumEffectsPlaying, "SDL_HapticNumEffectsPlaying");
188     lib.bindSymbol(cast(void**)&SDL_HapticQuery, "SDL_HapticQuery");
189     lib.bindSymbol(cast(void**)&SDL_HapticNumAxes, "SDL_HapticNumAxes");
190     lib.bindSymbol(cast(void**)&SDL_HapticEffectSupported, "SDL_HapticEffectSupported");
191     lib.bindSymbol(cast(void**)&SDL_HapticNewEffect, "SDL_HapticNewEffect");
192     lib.bindSymbol(cast(void**)&SDL_HapticUpdateEffect, "SDL_HapticUpdateEffect");
193     lib.bindSymbol(cast(void**)&SDL_HapticRunEffect, "SDL_HapticRunEffect");
194     lib.bindSymbol(cast(void**)&SDL_HapticStopEffect, "SDL_HapticStopEffect");
195     lib.bindSymbol(cast(void**)&SDL_HapticDestroyEffect, "SDL_HapticDestroyEffect");
196     lib.bindSymbol(cast(void**)&SDL_HapticGetEffectStatus, "SDL_HapticGetEffectStatus");
197     lib.bindSymbol(cast(void**)&SDL_HapticSetGain, "SDL_HapticSetGain");
198     lib.bindSymbol(cast(void**)&SDL_HapticSetAutocenter, "SDL_HapticSetAutocenter");
199     lib.bindSymbol(cast(void**)&SDL_HapticPause, "SDL_HapticPause");
200     lib.bindSymbol(cast(void**)&SDL_HapticUnpause, "SDL_HapticUnpause");
201     lib.bindSymbol(cast(void**)&SDL_HapticStopAll, "SDL_HapticStopAll");
202     lib.bindSymbol(cast(void**)&SDL_HapticRumbleSupported, "SDL_HapticRumbleSupported");
203     lib.bindSymbol(cast(void**)&SDL_HapticRumbleInit, "SDL_HapticRumbleInit");
204     lib.bindSymbol(cast(void**)&SDL_HapticRumblePlay, "SDL_HapticRumblePlay");
205     lib.bindSymbol(cast(void**)&SDL_HapticRumbleStop, "SDL_HapticRumbleStop");
206     lib.bindSymbol(cast(void**)&SDL_SetHintWithPriority, "SDL_SetHintWithPriority");
207     lib.bindSymbol(cast(void**)&SDL_SetHint, "SDL_SetHint");
208     lib.bindSymbol(cast(void**)&SDL_GetHint, "SDL_GetHint");
209     lib.bindSymbol(cast(void**)&SDL_AddHintCallback, "SDL_AddHintCallback");
210     lib.bindSymbol(cast(void**)&SDL_DelHintCallback, "SDL_DelHintCallback");
211     lib.bindSymbol(cast(void**)&SDL_ClearHints, "SDL_ClearHints");
212     lib.bindSymbol(cast(void**)&SDL_NumJoysticks, "SDL_NumJoysticks");
213     lib.bindSymbol(cast(void**)&SDL_JoystickNameForIndex, "SDL_JoystickNameForIndex");
214     lib.bindSymbol(cast(void**)&SDL_JoystickOpen, "SDL_JoystickOpen");
215     lib.bindSymbol(cast(void**)&SDL_JoystickName, "SDL_JoystickName");
216     lib.bindSymbol(cast(void**)&SDL_JoystickGetDeviceGUID, "SDL_JoystickGetDeviceGUID");
217     lib.bindSymbol(cast(void**)&SDL_JoystickGetGUID, "SDL_JoystickGetGUID");
218     lib.bindSymbol(cast(void**)&SDL_JoystickGetGUIDString, "SDL_JoystickGetGUIDString");
219     lib.bindSymbol(cast(void**)&SDL_JoystickGetGUIDFromString, "SDL_JoystickGetGUIDFromString");
220     lib.bindSymbol(cast(void**)&SDL_JoystickGetAttached, "SDL_JoystickGetAttached");
221     lib.bindSymbol(cast(void**)&SDL_JoystickInstanceID, "SDL_JoystickInstanceID");
222     lib.bindSymbol(cast(void**)&SDL_JoystickNumAxes, "SDL_JoystickNumAxes");
223     lib.bindSymbol(cast(void**)&SDL_JoystickNumBalls, "SDL_JoystickNumBalls");
224     lib.bindSymbol(cast(void**)&SDL_JoystickNumHats, "SDL_JoystickNumHats");
225     lib.bindSymbol(cast(void**)&SDL_JoystickNumButtons, "SDL_JoystickNumButtons");
226     lib.bindSymbol(cast(void**)&SDL_JoystickUpdate, "SDL_JoystickUpdate");
227     lib.bindSymbol(cast(void**)&SDL_JoystickEventState, "SDL_JoystickEventState");
228     lib.bindSymbol(cast(void**)&SDL_JoystickGetAxis, "SDL_JoystickGetAxis");
229     lib.bindSymbol(cast(void**)&SDL_JoystickGetHat, "SDL_JoystickGetHat");
230     lib.bindSymbol(cast(void**)&SDL_JoystickGetBall, "SDL_JoystickGetBall");
231     lib.bindSymbol(cast(void**)&SDL_JoystickGetButton, "SDL_JoystickGetButton");
232     lib.bindSymbol(cast(void**)&SDL_JoystickClose, "SDL_JoystickClose");
233     lib.bindSymbol(cast(void**)&SDL_GetKeyboardFocus, "SDL_GetKeyboardFocus");
234     lib.bindSymbol(cast(void**)&SDL_GetKeyboardState, "SDL_GetKeyboardState");
235     lib.bindSymbol(cast(void**)&SDL_GetModState, "SDL_GetModState");
236     lib.bindSymbol(cast(void**)&SDL_SetModState, "SDL_SetModState");
237     lib.bindSymbol(cast(void**)&SDL_GetKeyFromScancode, "SDL_GetKeyFromScancode");
238     lib.bindSymbol(cast(void**)&SDL_GetScancodeFromKey, "SDL_GetScancodeFromKey");
239     lib.bindSymbol(cast(void**)&SDL_GetScancodeName, "SDL_GetScancodeName");
240     lib.bindSymbol(cast(void**)&SDL_GetScancodeFromName, "SDL_GetScancodeFromName");
241     lib.bindSymbol(cast(void**)&SDL_GetKeyName, "SDL_GetKeyName");
242     lib.bindSymbol(cast(void**)&SDL_GetKeyFromName, "SDL_GetKeyFromName");
243     lib.bindSymbol(cast(void**)&SDL_StartTextInput, "SDL_StartTextInput");
244     lib.bindSymbol(cast(void**)&SDL_IsTextInputActive, "SDL_IsTextInputActive");
245     lib.bindSymbol(cast(void**)&SDL_StopTextInput, "SDL_StopTextInput");
246     lib.bindSymbol(cast(void**)&SDL_SetTextInputRect, "SDL_SetTextInputRect");
247     lib.bindSymbol(cast(void**)&SDL_HasScreenKeyboardSupport, "SDL_HasScreenKeyboardSupport");
248     lib.bindSymbol(cast(void**)&SDL_IsScreenKeyboardShown, "SDL_IsScreenKeyboardShown");
249     lib.bindSymbol(cast(void**)&SDL_LoadObject, "SDL_LoadObject");
250     lib.bindSymbol(cast(void**)&SDL_LoadFunction, "SDL_LoadFunction");
251     lib.bindSymbol(cast(void**)&SDL_UnloadObject, "SDL_UnloadObject");
252     lib.bindSymbol(cast(void**)&SDL_LogSetAllPriority, "SDL_LogSetAllPriority");
253     lib.bindSymbol(cast(void**)&SDL_LogSetPriority, "SDL_LogSetPriority");
254     lib.bindSymbol(cast(void**)&SDL_LogGetPriority, "SDL_LogGetPriority");
255     lib.bindSymbol(cast(void**)&SDL_LogResetPriorities, "SDL_LogResetPriorities");
256     lib.bindSymbol(cast(void**)&SDL_Log, "SDL_Log");
257     lib.bindSymbol(cast(void**)&SDL_LogVerbose, "SDL_LogVerbose");
258     lib.bindSymbol(cast(void**)&SDL_LogDebug, "SDL_LogDebug");
259     lib.bindSymbol(cast(void**)&SDL_LogInfo, "SDL_LogInfo");
260     lib.bindSymbol(cast(void**)&SDL_LogWarn, "SDL_LogWarn");
261     lib.bindSymbol(cast(void**)&SDL_LogError, "SDL_LogError");
262     lib.bindSymbol(cast(void**)&SDL_LogCritical, "SDL_LogCritical");
263     lib.bindSymbol(cast(void**)&SDL_LogMessage, "SDL_LogMessage");
264     lib.bindSymbol(cast(void**)&SDL_LogMessageV, "SDL_LogMessageV");
265     lib.bindSymbol(cast(void**)&SDL_LogGetOutputFunction, "SDL_LogGetOutputFunction");
266     lib.bindSymbol(cast(void**)&SDL_LogSetOutputFunction, "SDL_LogSetOutputFunction");
267     lib.bindSymbol(cast(void**)&SDL_ShowMessageBox, "SDL_ShowMessageBox");
268     lib.bindSymbol(cast(void**)&SDL_ShowSimpleMessageBox, "SDL_ShowSimpleMessageBox");
269     lib.bindSymbol(cast(void**)&SDL_GetMouseFocus, "SDL_GetMouseFocus");
270     lib.bindSymbol(cast(void**)&SDL_GetMouseState, "SDL_GetMouseState");
271     lib.bindSymbol(cast(void**)&SDL_GetRelativeMouseState, "SDL_GetRelativeMouseState");
272     lib.bindSymbol(cast(void**)&SDL_WarpMouseInWindow, "SDL_WarpMouseInWindow");
273     lib.bindSymbol(cast(void**)&SDL_SetRelativeMouseMode, "SDL_SetRelativeMouseMode");
274     lib.bindSymbol(cast(void**)&SDL_GetRelativeMouseMode, "SDL_GetRelativeMouseMode");
275     lib.bindSymbol(cast(void**)&SDL_CreateCursor, "SDL_CreateCursor");
276     lib.bindSymbol(cast(void**)&SDL_CreateColorCursor, "SDL_CreateColorCursor");
277     lib.bindSymbol(cast(void**)&SDL_CreateSystemCursor, "SDL_CreateSystemCursor");
278     lib.bindSymbol(cast(void**)&SDL_SetCursor, "SDL_SetCursor");
279     lib.bindSymbol(cast(void**)&SDL_GetCursor, "SDL_GetCursor");
280     lib.bindSymbol(cast(void**)&SDL_GetDefaultCursor, "SDL_GetDefaultCursor");
281     lib.bindSymbol(cast(void**)&SDL_FreeCursor, "SDL_FreeCursor");
282     lib.bindSymbol(cast(void**)&SDL_ShowCursor, "SDL_ShowCursor");
283     lib.bindSymbol(cast(void**)&SDL_CreateMutex, "SDL_CreateMutex");
284     lib.bindSymbol(cast(void**)&SDL_LockMutex, "SDL_LockMutex");
285     lib.bindSymbol(cast(void**)&SDL_TryLockMutex, "SDL_TryLockMutex");
286     lib.bindSymbol(cast(void**)&SDL_UnlockMutex, "SDL_UnlockMutex");
287     lib.bindSymbol(cast(void**)&SDL_DestroyMutex, "SDL_DestroyMutex");
288     lib.bindSymbol(cast(void**)&SDL_CreateSemaphore, "SDL_CreateSemaphore");
289     lib.bindSymbol(cast(void**)&SDL_DestroySemaphore, "SDL_DestroySemaphore");
290     lib.bindSymbol(cast(void**)&SDL_SemWait, "SDL_SemWait");
291     lib.bindSymbol(cast(void**)&SDL_SemWaitTimeout, "SDL_SemWaitTimeout");
292     lib.bindSymbol(cast(void**)&SDL_SemPost, "SDL_SemPost");
293     lib.bindSymbol(cast(void**)&SDL_SemValue, "SDL_SemValue");
294     lib.bindSymbol(cast(void**)&SDL_CreateCond, "SDL_CreateCond");
295     lib.bindSymbol(cast(void**)&SDL_DestroyCond, "SDL_DestroyCond");
296     lib.bindSymbol(cast(void**)&SDL_CondSignal, "SDL_CondSignal");
297     lib.bindSymbol(cast(void**)&SDL_CondBroadcast, "SDL_CondBroadcast");
298     lib.bindSymbol(cast(void**)&SDL_CondWait, "SDL_CondWait");
299     lib.bindSymbol(cast(void**)&SDL_CondWaitTimeout, "SDL_CondWaitTimeout");
300     lib.bindSymbol(cast(void**)&SDL_GetPixelFormatName, "SDL_GetPixelFormatName");
301     lib.bindSymbol(cast(void**)&SDL_PixelFormatEnumToMasks, "SDL_PixelFormatEnumToMasks");
302     lib.bindSymbol(cast(void**)&SDL_MasksToPixelFormatEnum, "SDL_MasksToPixelFormatEnum");
303     lib.bindSymbol(cast(void**)&SDL_AllocFormat, "SDL_AllocFormat");
304     lib.bindSymbol(cast(void**)&SDL_FreeFormat, "SDL_FreeFormat");
305     lib.bindSymbol(cast(void**)&SDL_AllocPalette, "SDL_AllocPalette");
306     lib.bindSymbol(cast(void**)&SDL_SetPixelFormatPalette, "SDL_SetPixelFormatPalette");
307     lib.bindSymbol(cast(void**)&SDL_SetPaletteColors, "SDL_SetPaletteColors");
308     lib.bindSymbol(cast(void**)&SDL_FreePalette, "SDL_FreePalette");
309     lib.bindSymbol(cast(void**)&SDL_MapRGB, "SDL_MapRGB");
310     lib.bindSymbol(cast(void**)&SDL_MapRGBA, "SDL_MapRGBA");
311     lib.bindSymbol(cast(void**)&SDL_GetRGB, "SDL_GetRGB");
312     lib.bindSymbol(cast(void**)&SDL_GetRGBA, "SDL_GetRGBA");
313     lib.bindSymbol(cast(void**)&SDL_CalculateGammaRamp, "SDL_CalculateGammaRamp");
314     lib.bindSymbol(cast(void**)&SDL_GetPlatform, "SDL_GetPlatform");
315     lib.bindSymbol(cast(void**)&SDL_GetPowerInfo, "SDL_GetPowerInfo");
316     lib.bindSymbol(cast(void**)&SDL_HasIntersection, "SDL_HasIntersection");
317     lib.bindSymbol(cast(void**)&SDL_IntersectRect, "SDL_IntersectRect");
318     lib.bindSymbol(cast(void**)&SDL_UnionRect, "SDL_UnionRect");
319     lib.bindSymbol(cast(void**)&SDL_EnclosePoints, "SDL_EnclosePoints");
320     lib.bindSymbol(cast(void**)&SDL_IntersectRectAndLine, "SDL_IntersectRectAndLine");
321     lib.bindSymbol(cast(void**)&SDL_GetNumRenderDrivers, "SDL_GetNumRenderDrivers");
322     lib.bindSymbol(cast(void**)&SDL_GetRenderDriverInfo, "SDL_GetRenderDriverInfo");
323     lib.bindSymbol(cast(void**)&SDL_CreateWindowAndRenderer, "SDL_CreateWindowAndRenderer");
324     lib.bindSymbol(cast(void**)&SDL_CreateRenderer, "SDL_CreateRenderer");
325     lib.bindSymbol(cast(void**)&SDL_CreateSoftwareRenderer, "SDL_CreateSoftwareRenderer");
326     lib.bindSymbol(cast(void**)&SDL_GetRenderer, "SDL_GetRenderer");
327     lib.bindSymbol(cast(void**)&SDL_GetRendererInfo, "SDL_GetRendererInfo");
328     lib.bindSymbol(cast(void**)&SDL_GetRendererOutputSize, "SDL_GetRendererOutputSize");
329     lib.bindSymbol(cast(void**)&SDL_CreateTexture, "SDL_CreateTexture");
330     lib.bindSymbol(cast(void**)&SDL_CreateTextureFromSurface, "SDL_CreateTextureFromSurface");
331     lib.bindSymbol(cast(void**)&SDL_QueryTexture, "SDL_QueryTexture");
332     lib.bindSymbol(cast(void**)&SDL_SetTextureColorMod, "SDL_SetTextureColorMod");
333     lib.bindSymbol(cast(void**)&SDL_GetTextureColorMod, "SDL_GetTextureColorMod");
334     lib.bindSymbol(cast(void**)&SDL_SetTextureAlphaMod, "SDL_SetTextureAlphaMod");
335     lib.bindSymbol(cast(void**)&SDL_GetTextureAlphaMod, "SDL_GetTextureAlphaMod");
336     lib.bindSymbol(cast(void**)&SDL_SetTextureBlendMode, "SDL_SetTextureBlendMode");
337     lib.bindSymbol(cast(void**)&SDL_GetTextureBlendMode, "SDL_GetTextureBlendMode");
338     lib.bindSymbol(cast(void**)&SDL_UpdateTexture, "SDL_UpdateTexture");
339     lib.bindSymbol(cast(void**)&SDL_LockTexture, "SDL_LockTexture");
340     lib.bindSymbol(cast(void**)&SDL_UnlockTexture, "SDL_UnlockTexture");
341     lib.bindSymbol(cast(void**)&SDL_RenderTargetSupported, "SDL_RenderTargetSupported");
342     lib.bindSymbol(cast(void**)&SDL_SetRenderTarget, "SDL_SetRenderTarget");
343     lib.bindSymbol(cast(void**)&SDL_GetRenderTarget, "SDL_GetRenderTarget");
344     lib.bindSymbol(cast(void**)&SDL_RenderSetClipRect, "SDL_RenderSetClipRect");
345     lib.bindSymbol(cast(void**)&SDL_RenderGetClipRect, "SDL_RenderGetClipRect");
346     lib.bindSymbol(cast(void**)&SDL_RenderSetLogicalSize, "SDL_RenderSetLogicalSize");
347     lib.bindSymbol(cast(void**)&SDL_RenderGetLogicalSize, "SDL_RenderGetLogicalSize");
348     lib.bindSymbol(cast(void**)&SDL_RenderSetViewport, "SDL_RenderSetViewport");
349     lib.bindSymbol(cast(void**)&SDL_RenderGetViewport, "SDL_RenderGetViewport");
350     lib.bindSymbol(cast(void**)&SDL_RenderSetScale, "SDL_RenderSetScale");
351     lib.bindSymbol(cast(void**)&SDL_RenderGetScale, "SDL_RenderGetScale");
352     lib.bindSymbol(cast(void**)&SDL_SetRenderDrawColor, "SDL_SetRenderDrawColor");
353     lib.bindSymbol(cast(void**)&SDL_GetRenderDrawColor, "SDL_GetRenderDrawColor");
354     lib.bindSymbol(cast(void**)&SDL_SetRenderDrawBlendMode, "SDL_SetRenderDrawBlendMode");
355     lib.bindSymbol(cast(void**)&SDL_GetRenderDrawBlendMode, "SDL_GetRenderDrawBlendMode");
356     lib.bindSymbol(cast(void**)&SDL_RenderClear, "SDL_RenderClear");
357     lib.bindSymbol(cast(void**)&SDL_RenderDrawPoint, "SDL_RenderDrawPoint");
358     lib.bindSymbol(cast(void**)&SDL_RenderDrawPoints, "SDL_RenderDrawPoints");
359     lib.bindSymbol(cast(void**)&SDL_RenderDrawLine, "SDL_RenderDrawLine");
360     lib.bindSymbol(cast(void**)&SDL_RenderDrawLines, "SDL_RenderDrawLines");
361     lib.bindSymbol(cast(void**)&SDL_RenderDrawRect, "SDL_RenderDrawRect");
362     lib.bindSymbol(cast(void**)&SDL_RenderDrawRects, "SDL_RenderDrawRects");
363     lib.bindSymbol(cast(void**)&SDL_RenderFillRect, "SDL_RenderFillRect");
364     lib.bindSymbol(cast(void**)&SDL_RenderFillRects, "SDL_RenderFillRects");
365     lib.bindSymbol(cast(void**)&SDL_RenderCopy, "SDL_RenderCopy");
366     lib.bindSymbol(cast(void**)&SDL_RenderCopyEx, "SDL_RenderCopyEx");
367     lib.bindSymbol(cast(void**)&SDL_RenderReadPixels, "SDL_RenderReadPixels");
368     lib.bindSymbol(cast(void**)&SDL_RenderPresent, "SDL_RenderPresent");
369     lib.bindSymbol(cast(void**)&SDL_DestroyTexture, "SDL_DestroyTexture");
370     lib.bindSymbol(cast(void**)&SDL_DestroyRenderer, "SDL_DestroyRenderer");
371     lib.bindSymbol(cast(void**)&SDL_GL_BindTexture, "SDL_GL_BindTexture");
372     lib.bindSymbol(cast(void**)&SDL_GL_UnbindTexture, "SDL_GL_UnbindTexture");
373     lib.bindSymbol(cast(void**)&SDL_RWFromFile, "SDL_RWFromFile");
374     lib.bindSymbol(cast(void**)&SDL_RWFromFP, "SDL_RWFromFP");
375     lib.bindSymbol(cast(void**)&SDL_RWFromMem, "SDL_RWFromMem");
376     lib.bindSymbol(cast(void**)&SDL_RWFromConstMem, "SDL_RWFromConstMem");
377     lib.bindSymbol(cast(void**)&SDL_AllocRW, "SDL_AllocRW");
378     lib.bindSymbol(cast(void**)&SDL_FreeRW, "SDL_FreeRW");
379     lib.bindSymbol(cast(void**)&SDL_ReadU8, "SDL_ReadU8");
380     lib.bindSymbol(cast(void**)&SDL_ReadLE16, "SDL_ReadLE16");
381     lib.bindSymbol(cast(void**)&SDL_ReadBE16, "SDL_ReadBE16");
382     lib.bindSymbol(cast(void**)&SDL_ReadLE32, "SDL_ReadLE32");
383     lib.bindSymbol(cast(void**)&SDL_ReadBE32, "SDL_ReadBE32");
384     lib.bindSymbol(cast(void**)&SDL_ReadLE64, "SDL_ReadLE64");
385     lib.bindSymbol(cast(void**)&SDL_ReadBE64, "SDL_ReadBE64");
386     lib.bindSymbol(cast(void**)&SDL_WriteU8, "SDL_WriteU8");
387     lib.bindSymbol(cast(void**)&SDL_WriteLE16, "SDL_WriteLE16");
388     lib.bindSymbol(cast(void**)&SDL_WriteBE16, "SDL_WriteBE16");
389     lib.bindSymbol(cast(void**)&SDL_WriteLE32, "SDL_WriteLE32");
390     lib.bindSymbol(cast(void**)&SDL_WriteBE32, "SDL_WriteBE32");
391     lib.bindSymbol(cast(void**)&SDL_WriteLE64, "SDL_WriteLE64");
392     lib.bindSymbol(cast(void**)&SDL_WriteBE64, "SDL_WriteBE64");
393     lib.bindSymbol(cast(void**)&SDL_CreateShapedWindow, "SDL_CreateShapedWindow");
394     lib.bindSymbol(cast(void**)&SDL_IsShapedWindow, "SDL_IsShapedWindow");
395     lib.bindSymbol(cast(void**)&SDL_SetWindowShape, "SDL_SetWindowShape");
396     lib.bindSymbol(cast(void**)&SDL_GetShapedWindowMode, "SDL_GetShapedWindowMode");
397     lib.bindSymbol(cast(void**)&SDL_free, "SDL_free");
398     lib.bindSymbol(cast(void**)&SDL_CreateRGBSurface, "SDL_CreateRGBSurface");
399     lib.bindSymbol(cast(void**)&SDL_CreateRGBSurfaceFrom, "SDL_CreateRGBSurfaceFrom");
400     lib.bindSymbol(cast(void**)&SDL_FreeSurface, "SDL_FreeSurface");
401     lib.bindSymbol(cast(void**)&SDL_SetSurfacePalette, "SDL_SetSurfacePalette");
402     lib.bindSymbol(cast(void**)&SDL_LockSurface, "SDL_LockSurface");
403     lib.bindSymbol(cast(void**)&SDL_UnlockSurface, "SDL_UnlockSurface");
404     lib.bindSymbol(cast(void**)&SDL_LoadBMP_RW, "SDL_LoadBMP_RW");
405     lib.bindSymbol(cast(void**)&SDL_SaveBMP_RW, "SDL_SaveBMP_RW");
406     lib.bindSymbol(cast(void**)&SDL_SetSurfaceRLE, "SDL_SetSurfaceRLE");
407     lib.bindSymbol(cast(void**)&SDL_SetColorKey, "SDL_SetColorKey");
408     lib.bindSymbol(cast(void**)&SDL_GetColorKey, "SDL_GetColorKey");
409     lib.bindSymbol(cast(void**)&SDL_SetSurfaceColorMod, "SDL_SetSurfaceColorMod");
410     lib.bindSymbol(cast(void**)&SDL_GetSurfaceColorMod, "SDL_GetSurfaceColorMod");
411     lib.bindSymbol(cast(void**)&SDL_SetSurfaceAlphaMod, "SDL_SetSurfaceAlphaMod");
412     lib.bindSymbol(cast(void**)&SDL_GetSurfaceAlphaMod, "SDL_GetSurfaceAlphaMod");
413     lib.bindSymbol(cast(void**)&SDL_SetSurfaceBlendMode, "SDL_SetSurfaceBlendMode");
414     lib.bindSymbol(cast(void**)&SDL_GetSurfaceBlendMode, "SDL_GetSurfaceBlendMode");
415     lib.bindSymbol(cast(void**)&SDL_SetClipRect, "SDL_SetClipRect");
416     lib.bindSymbol(cast(void**)&SDL_GetClipRect, "SDL_GetClipRect");
417     lib.bindSymbol(cast(void**)&SDL_ConvertSurface, "SDL_ConvertSurface");
418     lib.bindSymbol(cast(void**)&SDL_ConvertSurfaceFormat, "SDL_ConvertSurfaceFormat");
419     lib.bindSymbol(cast(void**)&SDL_ConvertPixels, "SDL_ConvertPixels");
420     lib.bindSymbol(cast(void**)&SDL_FillRect, "SDL_FillRect");
421     lib.bindSymbol(cast(void**)&SDL_FillRects, "SDL_FillRects");
422     lib.bindSymbol(cast(void**)&SDL_UpperBlit, "SDL_UpperBlit");
423     lib.bindSymbol(cast(void**)&SDL_LowerBlit, "SDL_LowerBlit");
424     lib.bindSymbol(cast(void**)&SDL_SoftStretch, "SDL_SoftStretch");
425     lib.bindSymbol(cast(void**)&SDL_UpperBlitScaled, "SDL_UpperBlitScaled");
426     lib.bindSymbol(cast(void**)&SDL_LowerBlitScaled, "SDL_LowerBlitScaled");
427     version(Android) {
428         lib.bindSymbol(cast(void**)&SDL_AndroidGetJNIEnv, "SDL_AndroidGetJNIEnv");
429         lib.bindSymbol(cast(void**)&SDL_AndroidGetActivity, "SDL_AndroidGetActivity");
430 
431         lib.bindSymbol(cast(void**)&SDL_AndroidGetInternalStoragePath, "SDL_AndroidGetInternalStoragePath");
432         lib.bindSymbol(cast(void**)&SDL_AndroidGetInternalStorageState, "SDL_AndroidGetInternalStorageState");
433         lib.bindSymbol(cast(void**)&SDL_AndroidGetExternalStoragePath, "SDL_AndroidGetExternalStoragePath");
434     }
435 
436     lib.bindSymbol(cast(void**)&SDL_GetWindowWMInfo, "SDL_GetWindowWMInfo");
437     lib.bindSymbol(cast(void**)&SDL_CreateThread, "SDL_CreateThread");
438     lib.bindSymbol(cast(void**)&SDL_GetThreadName, "SDL_GetThreadName");
439     lib.bindSymbol(cast(void**)&SDL_ThreadID, "SDL_ThreadID");
440     lib.bindSymbol(cast(void**)&SDL_GetThreadID, "SDL_GetThreadID");
441     lib.bindSymbol(cast(void**)&SDL_SetThreadPriority, "SDL_SetThreadPriority");
442     lib.bindSymbol(cast(void**)&SDL_WaitThread, "SDL_WaitThread");
443     lib.bindSymbol(cast(void**)&SDL_TLSCreate, "SDL_TLSCreate");
444     lib.bindSymbol(cast(void**)&SDL_TLSGet, "SDL_TLSGet");
445     lib.bindSymbol(cast(void**)&SDL_TLSSet, "SDL_TLSSet");
446     lib.bindSymbol(cast(void**)&SDL_GetTicks, "SDL_GetTicks");
447     lib.bindSymbol(cast(void**)&SDL_GetPerformanceCounter, "SDL_GetPerformanceCounter");
448     lib.bindSymbol(cast(void**)&SDL_GetPerformanceFrequency, "SDL_GetPerformanceFrequency");
449     lib.bindSymbol(cast(void**)&SDL_Delay, "SDL_Delay");
450     lib.bindSymbol(cast(void**)&SDL_AddTimer, "SDL_AddTimer");
451     lib.bindSymbol(cast(void**)&SDL_RemoveTimer, "SDL_RemoveTimer");
452     lib.bindSymbol(cast(void**)&SDL_GetNumTouchDevices, "SDL_GetNumTouchDevices");
453     lib.bindSymbol(cast(void**)&SDL_GetTouchDevice, "SDL_GetTouchDevice");
454     lib.bindSymbol(cast(void**)&SDL_GetNumTouchFingers, "SDL_GetNumTouchFingers");
455     lib.bindSymbol(cast(void**)&SDL_GetTouchFinger, "SDL_GetTouchFinger");
456     lib.bindSymbol(cast(void**)&SDL_GetVersion, "SDL_GetVersion");
457     lib.bindSymbol(cast(void**)&SDL_GetRevision, "SDL_GetRevision");
458     lib.bindSymbol(cast(void**)&SDL_GetRevisionNumber, "SDL_GetRevisionNumber");
459     lib.bindSymbol(cast(void**)&SDL_GetNumVideoDrivers, "SDL_GetNumVideoDrivers");
460     lib.bindSymbol(cast(void**)&SDL_GetVideoDriver, "SDL_GetVideoDriver");
461     lib.bindSymbol(cast(void**)&SDL_VideoInit, "SDL_VideoInit");
462     lib.bindSymbol(cast(void**)&SDL_VideoQuit, "SDL_VideoQuit");
463     lib.bindSymbol(cast(void**)&SDL_GetCurrentVideoDriver, "SDL_GetCurrentVideoDriver");
464     lib.bindSymbol(cast(void**)&SDL_GetNumVideoDisplays, "SDL_GetNumVideoDisplays");
465     lib.bindSymbol(cast(void**)&SDL_GetDisplayName, "SDL_GetDisplayName");
466     lib.bindSymbol(cast(void**)&SDL_GetDisplayBounds, "SDL_GetDisplayBounds");
467     lib.bindSymbol(cast(void**)&SDL_GetNumDisplayModes, "SDL_GetNumDisplayModes");
468     lib.bindSymbol(cast(void**)&SDL_GetDisplayMode, "SDL_GetDisplayMode");
469     lib.bindSymbol(cast(void**)&SDL_GetDesktopDisplayMode, "SDL_GetDesktopDisplayMode");
470     lib.bindSymbol(cast(void**)&SDL_GetCurrentDisplayMode, "SDL_GetCurrentDisplayMode");
471     lib.bindSymbol(cast(void**)&SDL_GetClosestDisplayMode, "SDL_GetClosestDisplayMode");
472     lib.bindSymbol(cast(void**)&SDL_GetWindowDisplayIndex, "SDL_GetWindowDisplayIndex");
473     lib.bindSymbol(cast(void**)&SDL_SetWindowDisplayMode, "SDL_SetWindowDisplayMode");
474     lib.bindSymbol(cast(void**)&SDL_GetWindowDisplayMode, "SDL_GetWindowDisplayMode");
475     lib.bindSymbol(cast(void**)&SDL_GetWindowPixelFormat, "SDL_GetWindowPixelFormat");
476     lib.bindSymbol(cast(void**)&SDL_CreateWindow, "SDL_CreateWindow");
477     lib.bindSymbol(cast(void**)&SDL_CreateWindowFrom, "SDL_CreateWindowFrom");
478     lib.bindSymbol(cast(void**)&SDL_GetWindowID, "SDL_GetWindowID");
479     lib.bindSymbol(cast(void**)&SDL_GetWindowFromID, "SDL_GetWindowFromID");
480     lib.bindSymbol(cast(void**)&SDL_GetWindowFlags, "SDL_GetWindowFlags");
481     lib.bindSymbol(cast(void**)&SDL_SetWindowTitle, "SDL_SetWindowTitle");
482     lib.bindSymbol(cast(void**)&SDL_GetWindowTitle, "SDL_GetWindowTitle");
483     lib.bindSymbol(cast(void**)&SDL_SetWindowIcon, "SDL_SetWindowIcon");
484     lib.bindSymbol(cast(void**)&SDL_SetWindowData, "SDL_SetWindowData");
485     lib.bindSymbol(cast(void**)&SDL_GetWindowData, "SDL_GetWindowData");
486     lib.bindSymbol(cast(void**)&SDL_SetWindowPosition, "SDL_SetWindowPosition");
487     lib.bindSymbol(cast(void**)&SDL_GetWindowPosition, "SDL_GetWindowPosition");
488     lib.bindSymbol(cast(void**)&SDL_SetWindowSize, "SDL_SetWindowSize");
489     lib.bindSymbol(cast(void**)&SDL_GetWindowSize, "SDL_GetWindowSize");
490     lib.bindSymbol(cast(void**)&SDL_SetWindowMinimumSize, "SDL_SetWindowMinimumSize");
491     lib.bindSymbol(cast(void**)&SDL_GetWindowMinimumSize, "SDL_GetWindowMinimumSize");
492     lib.bindSymbol(cast(void**)&SDL_SetWindowMaximumSize, "SDL_SetWindowMaximumSize");
493     lib.bindSymbol(cast(void**)&SDL_GetWindowMaximumSize, "SDL_GetWindowMaximumSize");
494     lib.bindSymbol(cast(void**)&SDL_SetWindowBordered, "SDL_SetWindowBordered");
495     lib.bindSymbol(cast(void**)&SDL_ShowWindow, "SDL_ShowWindow");
496     lib.bindSymbol(cast(void**)&SDL_HideWindow, "SDL_HideWindow");
497     lib.bindSymbol(cast(void**)&SDL_RaiseWindow, "SDL_RaiseWindow");
498     lib.bindSymbol(cast(void**)&SDL_MaximizeWindow, "SDL_MaximizeWindow");
499     lib.bindSymbol(cast(void**)&SDL_MinimizeWindow, "SDL_MinimizeWindow");
500     lib.bindSymbol(cast(void**)&SDL_RestoreWindow, "SDL_RestoreWindow");
501     lib.bindSymbol(cast(void**)&SDL_SetWindowFullscreen, "SDL_SetWindowFullscreen");
502     lib.bindSymbol(cast(void**)&SDL_GetWindowSurface, "SDL_GetWindowSurface");
503     lib.bindSymbol(cast(void**)&SDL_UpdateWindowSurface, "SDL_UpdateWindowSurface");
504     lib.bindSymbol(cast(void**)&SDL_UpdateWindowSurfaceRects, "SDL_UpdateWindowSurfaceRects");
505     lib.bindSymbol(cast(void**)&SDL_SetWindowGrab, "SDL_SetWindowGrab");
506     lib.bindSymbol(cast(void**)&SDL_GetWindowGrab, "SDL_GetWindowGrab");
507     lib.bindSymbol(cast(void**)&SDL_SetWindowBrightness, "SDL_SetWindowBrightness");
508     lib.bindSymbol(cast(void**)&SDL_GetWindowBrightness, "SDL_GetWindowBrightness");
509     lib.bindSymbol(cast(void**)&SDL_SetWindowGammaRamp, "SDL_SetWindowGammaRamp");
510     lib.bindSymbol(cast(void**)&SDL_GetWindowGammaRamp, "SDL_GetWindowGammaRamp");
511     lib.bindSymbol(cast(void**)&SDL_DestroyWindow, "SDL_DestroyWindow");
512     lib.bindSymbol(cast(void**)&SDL_IsScreenSaverEnabled, "SDL_IsScreenSaverEnabled");
513     lib.bindSymbol(cast(void**)&SDL_EnableScreenSaver, "SDL_EnableScreenSaver");
514     lib.bindSymbol(cast(void**)&SDL_DisableScreenSaver, "SDL_DisableScreenSaver");
515     lib.bindSymbol(cast(void**)&SDL_GL_LoadLibrary, "SDL_GL_LoadLibrary");
516     lib.bindSymbol(cast(void**)&SDL_GL_GetProcAddress, "SDL_GL_GetProcAddress");
517     lib.bindSymbol(cast(void**)&SDL_GL_UnloadLibrary, "SDL_GL_UnloadLibrary");
518     lib.bindSymbol(cast(void**)&SDL_GL_ExtensionSupported, "SDL_GL_ExtensionSupported");
519     lib.bindSymbol(cast(void**)&SDL_GL_SetAttribute, "SDL_GL_SetAttribute");
520     lib.bindSymbol(cast(void**)&SDL_GL_GetAttribute, "SDL_GL_GetAttribute");
521     lib.bindSymbol(cast(void**)&SDL_GL_CreateContext, "SDL_GL_CreateContext");
522     lib.bindSymbol(cast(void**)&SDL_GL_MakeCurrent, "SDL_GL_MakeCurrent");
523     lib.bindSymbol(cast(void**)&SDL_GL_GetCurrentWindow, "SDL_GL_GetCurrentWindow");
524     lib.bindSymbol(cast(void**)&SDL_GL_GetCurrentContext, "SDL_GL_GetCurrentContext");
525     lib.bindSymbol(cast(void**)&SDL_GL_SetSwapInterval, "SDL_GL_SetSwapInterval");
526     lib.bindSymbol(cast(void**)&SDL_GL_GetSwapInterval, "SDL_GL_GetSwapInterval");
527     lib.bindSymbol(cast(void**)&SDL_GL_SwapWindow, "SDL_GL_SwapWindow");
528     lib.bindSymbol(cast(void**)&SDL_GL_DeleteContext, "SDL_GL_DeleteContext");
529 
530     if(errorCount() != errCount) return SDLSupport.badLibrary;
531     else loadedVersion = SDLSupport.sdl200;
532 
533     static if(sdlSupport >= SDLSupport.sdl201) {
534         lib.bindSymbol(cast(void**)&SDL_GetSystemRAM, "SDL_GetSystemRAM");
535         lib.bindSymbol(cast(void**)&SDL_GetBasePath, "SDL_GetBasePath");
536         lib.bindSymbol(cast(void**)&SDL_GetPrefPath, "SDL_GetPrefPath");
537         lib.bindSymbol(cast(void**)&SDL_UpdateYUVTexture, "SDL_UpdateYUVTexture");
538         lib.bindSymbol(cast(void**)&SDL_GL_GetDrawableSize, "SDL_GL_GetDrawableSize");
539 
540         version(Windows) {
541             lib.bindSymbol(cast(void**)&SDL_Direct3D9GetAdapterIndex, "SDL_Direct3D9GetAdapterIndex") ;
542             lib.bindSymbol(cast(void**)&SDL_RenderGetD3D9Device, "SDL_RenderGetD3D9Device");
543         }
544 
545         if(errorCount() != errCount) return SDLSupport.badLibrary;
546         else loadedVersion = SDLSupport.sdl201;
547     }
548 
549     static if(sdlSupport >= SDLSupport.sdl202) {
550         lib.bindSymbol(cast(void**)&SDL_GetDefaultAssertionHandler, "SDL_GetDefaultAssertionHandler");
551         lib.bindSymbol(cast(void**)&SDL_GetAssertionHandler, "SDL_GetAssertionHandler");
552         lib.bindSymbol(cast(void**)&SDL_HasAVX, "SDL_HasAVX");
553         lib.bindSymbol(cast(void**)&SDL_GameControllerAddMappingsFromRW, "SDL_GameControllerAddMappingsFromRW");
554         lib.bindSymbol(cast(void**)&SDL_GL_ResetAttributes, "SDL_GL_ResetAttributes");
555         lib.bindSymbol(cast(void**)&SDL_DetachThread, "SDL_DetachThread");
556 
557         version(Windows) {
558             lib.bindSymbol(cast(void**)&SDL_DXGIGetOutputInfo, "SDL_DXGIGetOutputInfo");
559         }
560 
561         if(errorCount() != errCount) return SDLSupport.badLibrary;
562         else loadedVersion = SDLSupport.sdl202;
563     }
564 
565     static if(sdlSupport >= SDLSupport.sdl203) {
566         loadedVersion = SDLSupport.sdl203;
567     }
568 
569     static if(sdlSupport >= SDLSupport.sdl204) {
570         lib.bindSymbol(cast(void**)&SDL_ClearQueuedAudio, "SDL_ClearQueuedAudio");
571         lib.bindSymbol(cast(void**)&SDL_GetQueuedAudioSize, "SDL_GetQueuedAudioSize");
572         lib.bindSymbol(cast(void**)&SDL_QueueAudio, "SDL_QueueAudio");
573         lib.bindSymbol(cast(void**)&SDL_HasAVX2, "SDL_HasAVX2");
574         lib.bindSymbol(cast(void**)&SDL_GameControllerFromInstanceID, "SDL_GameControllerFromInstanceID");
575         lib.bindSymbol(cast(void**)&SDL_JoystickCurrentPowerLevel, "SDL_JoystickCurrentPowerLevel");
576         lib.bindSymbol(cast(void**)&SDL_JoystickFromInstanceID, "SDL_JoystickFromInstanceID");
577         lib.bindSymbol(cast(void**)&SDL_CaptureMouse, "SDL_CaptureMouse");
578         lib.bindSymbol(cast(void**)&SDL_GetGlobalMouseState, "SDL_GetGlobalMouseState");
579         lib.bindSymbol(cast(void**)&SDL_WarpMouseGlobal, "SDL_WarpMouseGlobal");
580         lib.bindSymbol(cast(void**)&SDL_RenderIsClipEnabled, "SDL_RenderIsClipEnabled");
581         lib.bindSymbol(cast(void**)&SDL_GetDisplayDPI, "SDL_GetDisplayDPI");
582         lib.bindSymbol(cast(void**)&SDL_GetGrabbedWindow, "SDL_GetGrabbedWindow");
583         lib.bindSymbol(cast(void**)&SDL_SetWindowHitTest, "SDL_SetWindowHitTest");
584 
585         version(Windows) {
586             lib.bindSymbol(cast(void**)&SDL_SetWindowsMessageHook, "SDL_SetWindowsMessageHook");
587         }
588 
589         if(errorCount() != errCount) return SDLSupport.badLibrary;
590         else loadedVersion = SDLSupport.sdl204;
591     }
592 
593     static if(sdlSupport >= SDLSupport.sdl205) {
594         lib.bindSymbol(cast(void**)&SDL_DequeueAudio, "SDL_DequeueAudio");
595         lib.bindSymbol(cast(void**)&SDL_GetHintBoolean, "SDL_GetHintBoolean");
596         lib.bindSymbol(cast(void**)&SDL_RenderGetIntegerScale, "SDL_RenderGetIntegerScale");
597         lib.bindSymbol(cast(void**)&SDL_RenderSetIntegerScale, "SDL_RenderSetIntegerScale");
598         lib.bindSymbol(cast(void**)&SDL_CreateRGBSurfaceWithFormat, "SDL_CreateRGBSurfaceWithFormat");
599         lib.bindSymbol(cast(void**)&SDL_CreateRGBSurfaceWithFormatFrom, "SDL_CreateRGBSurfaceWithFormatFrom");
600         lib.bindSymbol(cast(void**)&SDL_GetDisplayUsableBounds, "SDL_GetDisplayUsableBounds");
601         lib.bindSymbol(cast(void**)&SDL_GetWindowBordersSize, "SDL_GetWindowBordersSize");
602         lib.bindSymbol(cast(void**)&SDL_GetWindowOpacity, "SDL_GetWindowOpacity");
603         lib.bindSymbol(cast(void**)&SDL_SetWindowInputFocus, "SDL_SetWindowInputFocus");
604         lib.bindSymbol(cast(void**)&SDL_SetWindowModalFor, "SDL_SetWindowModalFor");
605         lib.bindSymbol(cast(void**)&SDL_SetWindowOpacity, "SDL_SetWindowOpacity");
606         lib.bindSymbol(cast(void**)&SDL_SetWindowResizable, "SDL_SetWindowResizable");
607 
608         if(errorCount() != errCount) return SDLSupport.badLibrary;
609         else loadedVersion = SDLSupport.sdl205;
610     }
611 
612     static if(sdlSupport >= SDLSupport.sdl206) {
613         lib.bindSymbol(cast(void**)&SDL_ComposeCustomBlendMode, "SDL_ComposeCustomBlendMode");
614         lib.bindSymbol(cast(void**)&SDL_HasNEON, "SDL_HasNEON");
615         lib.bindSymbol(cast(void**)&SDL_GameControllerGetVendor, "SDL_GameControllerGetVendor");
616         lib.bindSymbol(cast(void**)&SDL_GameControllerGetProduct, "SDL_GameControllerGetProduct");
617         lib.bindSymbol(cast(void**)&SDL_GameControllerGetProductVersion, "SDL_GameControllerGetProductVersion");
618         lib.bindSymbol(cast(void**)&SDL_GameControllerMappingForIndex, "SDL_GameControllerMappingForIndex");
619         lib.bindSymbol(cast(void**)&SDL_GameControllerNumMappings, "SDL_GameControllerNumMappings");
620         lib.bindSymbol(cast(void**)&SDL_JoystickGetAxisInitialState, "SDL_JoystickGetAxisInitialState");
621         lib.bindSymbol(cast(void**)&SDL_JoystickGetDeviceVendor, "SDL_JoystickGetDeviceVendor");
622         lib.bindSymbol(cast(void**)&SDL_JoystickGetDeviceProduct, "SDL_JoystickGetDeviceProduct");
623         lib.bindSymbol(cast(void**)&SDL_JoystickGetDeviceProductVersion, "SDL_JoystickGetDeviceProductVersion");
624         lib.bindSymbol(cast(void**)&SDL_JoystickGetDeviceInstanceID, "SDL_JoystickGetDeviceInstanceID");
625         lib.bindSymbol(cast(void**)&SDL_JoystickGetDeviceType, "SDL_JoystickGetDeviceType");
626         lib.bindSymbol(cast(void**)&SDL_JoystickGetProduct, "SDL_JoystickGetProduct");
627         lib.bindSymbol(cast(void**)&SDL_JoystickGetProductVersion, "SDL_JoystickGetProductVersion");
628         lib.bindSymbol(cast(void**)&SDL_JoystickGetType, "SDL_JoystickGetType");
629         lib.bindSymbol(cast(void**)&SDL_JoystickGetVendor, "SDL_JoystickGetVendor");
630         lib.bindSymbol(cast(void**)&SDL_LoadFile_RW, "SDL_LoadFile_RW");
631         lib.bindSymbol(cast(void**)&SDL_DuplicateSurface, "SDL_DuplicateSurface");
632         lib.bindSymbol(cast(void**)&SDL_Vulkan_CreateSurface, "SDL_Vulkan_CreateSurface");
633         lib.bindSymbol(cast(void**)&SDL_Vulkan_GetDrawableSize, "SDL_Vulkan_GetDrawableSize");
634         lib.bindSymbol(cast(void**)&SDL_Vulkan_GetInstanceExtensions, "SDL_Vulkan_GetInstanceExtensions");
635         lib.bindSymbol(cast(void**)&SDL_Vulkan_GetVkGetInstanceProcAddr, "SDL_Vulkan_GetVkGetInstanceProcAddr");
636         lib.bindSymbol(cast(void**)&SDL_Vulkan_LoadLibrary, "SDL_Vulkan_LoadLibrary");
637         lib.bindSymbol(cast(void**)&SDL_Vulkan_UnloadLibrary, "SDL_Vulkan_UnloadLibrary");
638 
639         if(errorCount() != errCount) return SDLSupport.badLibrary;
640         else loadedVersion = SDLSupport.sdl206;
641     }
642 
643     static if(sdlSupport >= SDLSupport.sdl207) {
644         lib.bindSymbol(cast(void**)&SDL_NewAudioStream, "SDL_NewAudioStream");
645         lib.bindSymbol(cast(void**)&SDL_AudioStreamPut, "SDL_AudioStreamPut");
646         lib.bindSymbol(cast(void**)&SDL_AudioStreamGet, "SDL_AudioStreamGet");
647         lib.bindSymbol(cast(void**)&SDL_AudioStreamAvailable, "SDL_AudioStreamAvailable");
648         lib.bindSymbol(cast(void**)&SDL_AudioStreamFlush, "SDL_AudioStreamFlush");
649         lib.bindSymbol(cast(void**)&SDL_AudioStreamClear, "SDL_AudioStreamClear");
650         lib.bindSymbol(cast(void**)&SDL_FreeAudioStream, "SDL_FreeAudioStream");
651         lib.bindSymbol(cast(void**)&SDL_LockJoysticks, "SDL_LockJoysticks");
652         lib.bindSymbol(cast(void**)&SDL_UnlockJoysticks, "SDL_UnlockJoysticks");
653         lib.bindSymbol(cast(void**)&SDL_JoystickGetDeviceProduct, "SDL_JoystickGetDeviceProduct");
654         lib.bindSymbol(cast(void**)&SDL_JoystickGetDeviceProductVersion, "SDL_JoystickGetDeviceProductVersion");
655         lib.bindSymbol(cast(void**)&SDL_JoystickGetDeviceInstanceID, "SDL_JoystickGetDeviceInstanceID");
656         lib.bindSymbol(cast(void**)&SDL_JoystickGetDeviceType, "SDL_JoystickGetDeviceType");
657         lib.bindSymbol(cast(void**)&SDL_JoystickGetProduct, "SDL_JoystickGetProduct");
658         lib.bindSymbol(cast(void**)&SDL_JoystickGetProductVersion, "SDL_JoystickGetProductVersion");
659         lib.bindSymbol(cast(void**)&SDL_JoystickGetType, "SDL_JoystickGetType");
660         lib.bindSymbol(cast(void**)&SDL_JoystickGetVendor, "SDL_JoystickGetVendor");
661         lib.bindSymbol(cast(void**)&SDL_LoadFile_RW, "SDL_LoadFile_RW");
662         lib.bindSymbol(cast(void**)&SDL_DuplicateSurface, "SDL_DuplicateSurface");
663         lib.bindSymbol(cast(void**)&SDL_Vulkan_CreateSurface, "SDL_Vulkan_CreateSurface");
664         lib.bindSymbol(cast(void**)&SDL_Vulkan_GetDrawableSize, "SDL_Vulkan_GetDrawableSize");
665         lib.bindSymbol(cast(void**)&SDL_Vulkan_GetInstanceExtensions, "SDL_Vulkan_GetInstanceExtensions");
666         lib.bindSymbol(cast(void**)&SDL_Vulkan_GetVkGetInstanceProcAddr, "SDL_Vulkan_GetVkGetInstanceProcAddr");
667         lib.bindSymbol(cast(void**)&SDL_Vulkan_LoadLibrary, "SDL_Vulkan_LoadLibrary");
668         lib.bindSymbol(cast(void**)&SDL_Vulkan_UnloadLibrary, "SDL_Vulkan_UnloadLibrary");
669 
670         if(errorCount() != errCount) return SDLSupport.badLibrary;
671         else loadedVersion = SDLSupport.sdl207;
672     }
673 
674     static if(sdlSupport >= SDLSupport.sdl208) {
675         lib.bindSymbol(cast(void**)&SDL_RenderGetMetalLayer, "SDL_RenderGetMetalLayer");
676         lib.bindSymbol(cast(void**)&SDL_RenderGetMetalCommandEncoder, "SDL_RenderGetMetalCommandEncoder");
677         lib.bindSymbol(cast(void**)&SDL_SetYUVConversionMode, "SDL_SetYUVConversionMode");
678         lib.bindSymbol(cast(void**)&SDL_GetYUVConversionMode, "SDL_GetYUVConversionMode");
679         lib.bindSymbol(cast(void**)&SDL_GetYUVConversionModeForResolution, "SDL_GetYUVConversionModeForResolution");
680 
681         version(Android) {
682             lib.bindSymbol(cast(void**)&SDL_IsAndroidTV, "SDL_IsAndroidTV");
683         }
684 
685         if(errorCount() != errCount) return SDLSupport.badLibrary;
686         else loadedVersion = SDLSupport.sdl208;
687     }
688 
689     static if(sdlSupport >= SDLSupport.sdl209) {
690         lib.bindSymbol(cast(void**)&SDL_HasAVX512F, "SDL_HasAVX512F");
691         lib.bindSymbol(cast(void**)&SDL_GameControllerMappingForDeviceIndex, "SDL_GameControllerMappingForDeviceIndex");
692         lib.bindSymbol(cast(void**)&SDL_GameControllerRumble, "SDL_GameControllerRumble");
693         lib.bindSymbol(cast(void**)&SDL_JoystickRumble, "SDL_JoystickRumble");
694         lib.bindSymbol(cast(void**)&SDL_HasColorKey, "SDL_HasColorKey");
695         lib.bindSymbol(cast(void**)&SDL_GetDisplayOrientation, "SDL_GetDisplayOrientation");
696         lib.bindSymbol(cast(void**)&SDL_CreateThreadWithStackSize, "SDL_CreateThreadWithStackSize");
697 
698         version(linux) {
699             lib.bindSymbol(cast(void**)&SDL_LinuxSetThreadPriority, "SDL_LinuxSetThreadPriority");
700         }
701         else version(Android) {
702             lib.bindSymbol(cast(void**)&SDL_IsChromebook, "SDL_IsChromebook");
703             lib.bindSymbol(cast(void**)&SDL_IsDeXMode, "SDL_IsDeXMode");
704             lib.bindSymbol(cast(void**)&SDL_AndroidBackButton, "SDL_AndroidBackButton");
705         }
706 
707         if(errorCount() != errCount) return SDLSupport.badLibrary;
708         else loadedVersion = SDLSupport.sdl209;
709     }
710 
711     static if(sdlSupport >= SDLSupport.sdl2010) {
712         lib.bindSymbol(cast(void**)&SDL_SIMDGetAlignment, "SDL_SIMDGetAlignment");
713         lib.bindSymbol(cast(void**)&SDL_SIMDAlloc, "SDL_SIMDAlloc");
714         lib.bindSymbol(cast(void**)&SDL_SIMDFree, "SDL_SIMDFree");
715         lib.bindSymbol(cast(void**)&SDL_GameControllerGetPlayerIndex, "SDL_GameControllerGetPlayerIndex");
716         lib.bindSymbol(cast(void**)&SDL_JoystickGetDevicePlayerIndex, "SDL_JoystickGetDevicePlayerIndex");
717         lib.bindSymbol(cast(void**)&SDL_JoystickGetPlayerIndex, "SDL_JoystickGetPlayerIndex");
718         lib.bindSymbol(cast(void**)&SDL_RenderDrawPointF, "SDL_RenderDrawPointF");
719         lib.bindSymbol(cast(void**)&SDL_RenderDrawPointsF, "SDL_RenderDrawPointsF");
720         lib.bindSymbol(cast(void**)&SDL_RenderDrawLineF, "SDL_RenderDrawLineF");
721         lib.bindSymbol(cast(void**)&SDL_RenderDrawLinesF, "SDL_RenderDrawLinesF");
722         lib.bindSymbol(cast(void**)&SDL_RenderDrawRectF, "SDL_RenderDrawRectF");
723         lib.bindSymbol(cast(void**)&SDL_RenderDrawRectsF, "SDL_RenderDrawRectsF");
724         lib.bindSymbol(cast(void**)&SDL_RenderFillRectF, "SDL_RenderFillRectF");
725         lib.bindSymbol(cast(void**)&SDL_RenderFillRectsF, "SDL_RenderFillRectsF");
726         lib.bindSymbol(cast(void**)&SDL_RenderCopyF, "SDL_RenderCopyF");
727         lib.bindSymbol(cast(void**)&SDL_RenderCopyExF, "SDL_RenderCopyExF");
728         lib.bindSymbol(cast(void**)&SDL_RenderFlush, "SDL_RenderFlush");lib.bindSymbol(cast(void**)&SDL_Vulkan_CreateSurface, "SDL_Vulkan_CreateSurface");
729         lib.bindSymbol(cast(void**)&SDL_RWsize, "SDL_RWsize");
730         lib.bindSymbol(cast(void**)&SDL_RWseek, "SDL_RWseek");
731         lib.bindSymbol(cast(void**)&SDL_RWtell, "SDL_RWtell");
732         lib.bindSymbol(cast(void**)&SDL_RWread, "SDL_RWread");
733         lib.bindSymbol(cast(void**)&SDL_RWwrite, "SDL_RWwrite");
734         lib.bindSymbol(cast(void**)&SDL_RWclose, "SDL_RWclose");
735         lib.bindSymbol(cast(void**)&SDL_GetTouchDeviceType, "SDL_GetTouchDeviceType");
736 
737         if(errorCount() != errCount) return SDLSupport.badLibrary;
738         else loadedVersion = SDLSupport.sdl2010;
739     }
740 
741     static if(sdlSupport >= SDLSupport.sdl2012) {
742         lib.bindSymbol(cast(void**)&SDL_HasARMSIMD, "SDL_HasARMSIMD");
743         lib.bindSymbol(cast(void**)&SDL_GameControllerTypeForIndex, "SDL_GameControllerTypeForIndex");
744         lib.bindSymbol(cast(void**)&SDL_GameControllerFromPlayerIndex, "SDL_GameControllerFromPlayerIndex");
745         lib.bindSymbol(cast(void**)&SDL_GameControllerGetType, "SDL_GameControllerGetType");
746         lib.bindSymbol(cast(void**)&SDL_GameControllerSetPlayerIndex, "SDL_GameControllerSetPlayerIndex");
747         lib.bindSymbol(cast(void**)&SDL_JoystickFromPlayerIndex, "SDL_JoystickFromPlayerIndex");
748         lib.bindSymbol(cast(void**)&SDL_JoystickGetGUID, "SDL_JoystickGetGUID");
749         lib.bindSymbol(cast(void**)&SDL_SetTextureScaleMode, "SDL_SetTextureScaleMode");
750         lib.bindSymbol(cast(void**)&SDL_GetTextureScaleMode, "SDL_GetTextureScaleMode");
751         lib.bindSymbol(cast(void**)&SDL_LockTextureToSurface, "SDL_LockTextureToSurface");
752         version(Android) {
753             lib.bindSymbol(cast(void**)&SDL_GetAndroidSDKVersion, "SDL_GetAndroidSDKVersion");
754         }
755 
756 
757         if(errorCount() != errCount) return SDLSupport.badLibrary;
758         else loadedVersion = SDLSupport.sdl2012;
759     }
760 
761     return loadedVersion;
762 }