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