1 /*
2 
3 Boost Software License - Version 1.0 - August 17th, 2003
4 
5 Permission is hereby granted, free of charge, to any person or organization
6 obtaining a copy of the software and accompanying documentation covered by
7 this license (the "Software") to use, reproduce, display, distribute,
8 execute, and transmit the Software, and to prepare derivative works of the
9 Software, and to permit third-parties to whom the Software is furnished to
10 do so, all subject to the following:
11 
12 The copyright notices in the Software and this entire statement, including
13 the above license grant, this restriction and the following disclaimer,
14 must be included in all copies of the Software, in whole or in part, and
15 all derivative works of the Software, unless such copies or derivative
16 works are solely in the form of machine-executable object code generated by
17 a source language processor.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
22 SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
23 FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
24 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 DEALINGS IN THE SOFTWARE.
26 
27 */
28 module derelict.physfs.dynload;
29 
30 version(Derelict_Static) {}
31 else version(DerelictPHYSFS_Static) {}
32 else { version = DerelictPHYSFS_Dynamic; }
33 
34 version(DerelictPHYSFS_Dynamic):
35 
36 public import derelict.physfs.types;
37 import derelict.util.loader,
38        derelict.util.system;
39 
40 extern(C) @nogc nothrow {
41     // 2.0 API
42     alias da_PHYSFS_getLinkedVersion = void function(PHYSFS_Version*);
43     alias da_PHYSFS_init = int function(const(char)*);
44     alias da_PHYSFS_deinit = int function();
45     alias da_PHYSFS_supportedArchiveTypes = const(PHYSFS_ArchiveInfo*)* function();
46     alias da_PHYSFS_freeList = void function(void*);
47     alias da_PHYSFS_getLastError = const(char)* function();
48     alias da_PHYSFS_getDirSeparator = const(char)* function();
49     alias da_PHYSFS_permitSymbolicLinks = void function(int);
50     alias da_PHYSFS_getCdRomDirs = char** function();
51     alias da_PHYSFS_getBaseDir = const(char)* function();
52     alias da_PHYSFS_getUserDir = const(char)* function();
53     alias da_PHYSFS_getWriteDir = const(char)* function();
54     alias da_PHYSFS_setWriteDir = int function(const(char)*);
55     alias da_PHYSFS_addToSearchPath = int function(const(char)*, int);
56     alias da_PHYSFS_removeFromSearchPath = int function(const(char)*);
57     alias da_PHYSFS_getSearchPath = char** function();
58     alias da_PHYSFS_setSaneConfig = int function(const(char)*, const(char)*, const(char)*, int, int);
59     alias da_PHYSFS_mkdir = int function(const(char)*);
60     alias da_PHYSFS_delete = int function(const(char)*);
61     alias da_PHYSFS_getRealDir = const(char)* function(const(char)*);
62     alias da_PHYSFS_enumerateFiles = char** function(const(char)*);
63     alias da_PHYSFS_exists = int function(const(char)*);
64     alias da_PHYSFS_isDirectory = int function(const(char)*);
65     alias da_PHYSFS_isSymbolicLink = int function(const(char)*);
66     alias da_PHYSFS_getLastModTime = PHYSFS_sint64 function(const(char)*);
67     alias da_PHYSFS_openWrite = PHYSFS_File* function(const(char)*);
68     alias da_PHYSFS_openAppend = PHYSFS_File* function(const(char)*);
69     alias da_PHYSFS_openRead = PHYSFS_File* function(const(char)*);
70     alias da_PHYSFS_close = int function(PHYSFS_File*);
71     alias da_PHYSFS_read = PHYSFS_sint64 function(PHYSFS_File*, void*, PHYSFS_uint32, PHYSFS_uint32);
72     alias da_PHYSFS_write = PHYSFS_sint64 function(PHYSFS_File*, const(void)*, PHYSFS_uint32, PHYSFS_uint32);
73     alias da_PHYSFS_eof = int function(PHYSFS_File*);
74     alias da_PHYSFS_tell = PHYSFS_sint64 function(PHYSFS_File*);
75     alias da_PHYSFS_seek = int function(PHYSFS_File*, PHYSFS_uint64);
76     alias da_PHYSFS_fileLength = PHYSFS_sint64 function(PHYSFS_File*);
77     alias da_PHYSFS_setBuffer = int function(PHYSFS_File*, PHYSFS_uint64);
78     alias da_PHYSFS_flush = int function(PHYSFS_File*);
79     alias da_PHYSFS_swapSLE16 = PHYSFS_sint16 function(PHYSFS_sint16);
80     alias da_PHYSFS_swapULE16 = PHYSFS_uint16 function(PHYSFS_uint16);
81     alias da_PHYSFS_swapSLE32 = PHYSFS_sint32 function(PHYSFS_sint32);
82     alias da_PHYSFS_swapULE32 = PHYSFS_uint32 function(PHYSFS_uint32);
83     alias da_PHYSFS_swapSLE64 = PHYSFS_sint64 function(PHYSFS_sint64);
84     alias da_PHYSFS_swapULE64 = PHYSFS_uint64 function(PHYSFS_uint64);
85     alias da_PHYSFS_swapSBE16 = PHYSFS_sint16 function(PHYSFS_sint16);
86     alias da_PHYSFS_swapUBE16 = PHYSFS_uint16 function(PHYSFS_uint16);
87     alias da_PHYSFS_swapSBE32 = PHYSFS_sint32 function(PHYSFS_sint32);
88     alias da_PHYSFS_swapUBE32 = PHYSFS_uint32 function(PHYSFS_uint32);
89     alias da_PHYSFS_swapSBE64 = PHYSFS_sint64 function(PHYSFS_sint64);
90     alias da_PHYSFS_swapUBE64 = PHYSFS_sint64 function(PHYSFS_uint64);
91     alias da_PHYSFS_readSLE16 = int function(PHYSFS_File*, PHYSFS_sint16*);
92     alias da_PHYSFS_readULE16 = int function(PHYSFS_File*, PHYSFS_uint16*);
93     alias da_PHYSFS_readSLE32 = int function(PHYSFS_File*, PHYSFS_sint32*);
94     alias da_PHYSFS_readULE32 = int function(PHYSFS_File*, PHYSFS_uint32*);
95     alias da_PHYSFS_readSLE64 = int function(PHYSFS_File*, PHYSFS_sint64*);
96     alias da_PHYSFS_readULE64 = int function(PHYSFS_File*, PHYSFS_uint64*);
97     alias da_PHYSFS_readSBE16 = int function(PHYSFS_File*, PHYSFS_sint16*);
98     alias da_PHYSFS_readUBE16 = int function(PHYSFS_File*, PHYSFS_uint16*);
99     alias da_PHYSFS_readSBE32 = int function(PHYSFS_File*, PHYSFS_sint32*);
100     alias da_PHYSFS_readUBE32 = int function(PHYSFS_File*, PHYSFS_uint32*);
101     alias da_PHYSFS_readSBE64 = int function(PHYSFS_File*, PHYSFS_sint64*);
102     alias da_PHYSFS_readUBE64 = int function(PHYSFS_File*, PHYSFS_uint64*);
103     alias da_PHYSFS_writeSLE16 = int function(PHYSFS_File*, PHYSFS_sint16);
104     alias da_PHYSFS_writeULE16 = int function(PHYSFS_File*, PHYSFS_uint16);
105     alias da_PHYSFS_writeSLE32 = int function(PHYSFS_File*, PHYSFS_sint32);
106     alias da_PHYSFS_writeULE32 = int function(PHYSFS_File*, PHYSFS_uint32);
107     alias da_PHYSFS_writeSLE64 = int function(PHYSFS_File*, PHYSFS_sint64);
108     alias da_PHYSFS_writeULE64 = int function(PHYSFS_File*, PHYSFS_uint64);
109     alias da_PHYSFS_writeSBE16 = int function(PHYSFS_File*, PHYSFS_sint16);
110     alias da_PHYSFS_writeUBE16 = int function(PHYSFS_File*, PHYSFS_uint16);
111     alias da_PHYSFS_writeSBE32 = int function(PHYSFS_File*, PHYSFS_sint32);
112     alias da_PHYSFS_writeUBE32 = int function(PHYSFS_File*, PHYSFS_uint32);
113     alias da_PHYSFS_writeSBE64 = int function(PHYSFS_File*, PHYSFS_sint64);
114     alias da_PHYSFS_writeUBE64 = int function(PHYSFS_File*, PHYSFS_uint64);
115     alias da_PHYSFS_isInit = int function();
116     alias da_PHYSFS_symbolicLinksPermitted = int function();
117     alias da_PHYSFS_setAllocator = int function(const(PHYSFS_Allocator)*);
118     alias da_PHYSFS_mount = int function(const(char)*, const(char)*, int);
119     alias da_PHYSFS_getMountPoint = const(char)* function(const(char)*);
120     alias da_PHYSFS_getCdRomDirsCallback = void function(PHYSFS_StringCallback, void*);
121     alias da_PHYSFS_getSearchPathCallback = void function(PHYSFS_StringCallback, void*);
122     alias da_PHYSFS_enumerateFilesCallback = void function(const(char)*, PHYSFS_EnumFilesCallback, void*);
123     alias da_PHYSFS_utf8FromUcs4 = void function(const(PHYSFS_uint32)*, char*, PHYSFS_uint64);
124     alias da_PHYSFS_utf8ToUcs4 = void function(const(char)*, PHYSFS_uint32*, PHYSFS_uint64);
125     alias da_PHYSFS_utf8FromUcs2 = void function(const(PHYSFS_uint16)*, char*, PHYSFS_uint64);
126     alias da_PHYSFS_utf8ToUcs2 = void function(const(char)*, PHYSFS_uint16*, PHYSFS_uint64);
127     alias da_PHYSFS_utf8FromLatin1 = void function(const(char)*, char*, PHYSFS_uint64);
128     // 2.1 API
129     alias da_PHYSFS_unmount = int function(const(char)*);
130     alias da_PHYSFS_getAllocator = const(PHYSFS_Allocator)* function();
131     alias da_PHYSFS_stat = int function(const(char)*, PHYSFS_Stat*);
132     alias da_PHYSFS_utf8FromUtf16 = void function(const(PHYSFS_uint16)*, char*, PHYSFS_uint64);
133     alias da_PHYSFS_utf8ToUtf16 = void function(const(char)*, PHYSFS_uint16*, PHYSFS_uint64);
134     alias da_PHYSFS_readBytes = PHYSFS_sint64 function(PHYSFS_File*, void*, PHYSFS_uint64);
135     alias da_PHYSFS_writeBytes = PHYSFS_sint64 function(PHYSFS_File*, const(void)*, PHYSFS_uint64);
136     alias da_PHYSFS_mountIo = int function(PHYSFS_Io*, const(char)*, const(char)*, int);
137     alias da_PHYSFS_mountMemory = int function(const(void)*, PHYSFS_uint64, UnmountCallback, const(char)*, int);
138     alias da_PHYSFS_mountHandle = int function(PHYSFS_File*, const(char)*, const(char)*, int);
139     alias da_PHYSFS_getLastErrorCode = PHYSFS_ErrorCode function();
140     alias da_PHYSFS_getErrorByCode = const(char)* function(PHYSFS_ErrorCode);
141     alias da_PHYSFS_setErrorCode = void function(PHYSFS_ErrorCode);
142     alias da_PHYSFS_getPrefDir = const(char)* function(const(char)*, const(char)*);
143     alias da_PHYSFS_registerArchiver = int function(const(PHYSFS_Archiver)*);
144     alias da_PHYSFS_deregisterArchiver = int function(const(char)*);
145 }
146 
147 __gshared {
148     da_PHYSFS_getLinkedVersion PHYSFS_getLinkedVersion;
149     da_PHYSFS_init PHYSFS_init;
150     da_PHYSFS_deinit PHYSFS_deinit;
151     da_PHYSFS_supportedArchiveTypes PHYSFS_supportedArchiveTypes;
152     da_PHYSFS_freeList PHYSFS_freeList;
153     da_PHYSFS_getLastError PHYSFS_getLastError;
154     da_PHYSFS_getDirSeparator PHYSFS_getDirSeparator;
155     da_PHYSFS_permitSymbolicLinks PHYSFS_permitSymbolicLinks;
156     da_PHYSFS_getCdRomDirs PHYSFS_getCdRomDirs;
157     da_PHYSFS_getBaseDir PHYSFS_getBaseDir;
158     da_PHYSFS_getUserDir PHYSFS_getUserDir;
159     da_PHYSFS_getWriteDir PHYSFS_getWriteDir;
160     da_PHYSFS_setWriteDir PHYSFS_setWriteDir;
161     da_PHYSFS_addToSearchPath PHYSFS_addToSearchPath;
162     da_PHYSFS_removeFromSearchPath PHYSFS_removeFromSearchPath;
163     da_PHYSFS_getSearchPath PHYSFS_getSearchPath;
164     da_PHYSFS_setSaneConfig PHYSFS_setSaneConfig;
165     da_PHYSFS_mkdir PHYSFS_mkdir;
166     da_PHYSFS_delete PHYSFS_delete;
167     da_PHYSFS_getRealDir PHYSFS_getRealDir;
168     da_PHYSFS_enumerateFiles PHYSFS_enumerateFiles;
169     da_PHYSFS_exists PHYSFS_exists;
170     da_PHYSFS_isDirectory PHYSFS_isDirectory;
171     da_PHYSFS_isSymbolicLink PHYSFS_isSymbolicLink;
172     da_PHYSFS_getLastModTime PHYSFS_getLastModTime;
173     da_PHYSFS_openWrite PHYSFS_openWrite;
174     da_PHYSFS_openAppend PHYSFS_openAppend;
175     da_PHYSFS_openRead PHYSFS_openRead;
176     da_PHYSFS_close PHYSFS_close;
177     da_PHYSFS_read PHYSFS_read;
178     da_PHYSFS_write PHYSFS_write;
179     da_PHYSFS_eof PHYSFS_eof;
180     da_PHYSFS_tell PHYSFS_tell;
181     da_PHYSFS_seek PHYSFS_seek;
182     da_PHYSFS_fileLength PHYSFS_fileLength;
183     da_PHYSFS_setBuffer PHYSFS_setBuffer;
184     da_PHYSFS_flush PHYSFS_flush;
185     da_PHYSFS_swapSLE16 PHYSFS_swapSLE16;
186     da_PHYSFS_swapULE16 PHYSFS_swapULE16;
187     da_PHYSFS_swapSLE32 PHYSFS_swapSLE32;
188     da_PHYSFS_swapULE32 PHYSFS_swapULE32;
189     da_PHYSFS_swapSLE64 PHYSFS_swapSLE64;
190     da_PHYSFS_swapULE64 PHYSFS_swapULE64;
191     da_PHYSFS_swapSBE16 PHYSFS_swapSBE16;
192     da_PHYSFS_swapUBE16 PHYSFS_swapUBE16;
193     da_PHYSFS_swapSBE32 PHYSFS_swapSBE32;
194     da_PHYSFS_swapUBE32 PHYSFS_swapUBE32;
195     da_PHYSFS_swapSBE64 PHYSFS_swapSBE64;
196     da_PHYSFS_swapUBE64 PHYSFS_swapUBE64;
197     da_PHYSFS_readSLE16 PHYSFS_readSLE16;
198     da_PHYSFS_readULE16 PHYSFS_readULE16;
199     da_PHYSFS_readSLE32 PHYSFS_readSLE32;
200     da_PHYSFS_readULE32 PHYSFS_readULE32;
201     da_PHYSFS_readSLE64 PHYSFS_readSLE64;
202     da_PHYSFS_readULE64 PHYSFS_readULE64;
203     da_PHYSFS_readSBE16 PHYSFS_readSBE16;
204     da_PHYSFS_readUBE16 PHYSFS_readUBE16;
205     da_PHYSFS_readSBE32 PHYSFS_readSBE32;
206     da_PHYSFS_readUBE32 PHYSFS_readUBE32;
207     da_PHYSFS_readSBE64 PHYSFS_readSBE64;
208     da_PHYSFS_readUBE64 PHYSFS_readUBE64;
209     da_PHYSFS_writeSLE16 PHYSFS_writeSLE16;
210     da_PHYSFS_writeULE16 PHYSFS_writeULE16;
211     da_PHYSFS_writeSLE32 PHYSFS_writeSLE32;
212     da_PHYSFS_writeULE32 PHYSFS_writeULE32;
213     da_PHYSFS_writeSLE64 PHYSFS_writeSLE64;
214     da_PHYSFS_writeULE64 PHYSFS_writeULE64;
215     da_PHYSFS_writeSBE16 PHYSFS_writeSBE16;
216     da_PHYSFS_writeUBE16 PHYSFS_writeUBE16;
217     da_PHYSFS_writeSBE32 PHYSFS_writeSBE32;
218     da_PHYSFS_writeUBE32 PHYSFS_writeUBE32;
219     da_PHYSFS_writeSBE64 PHYSFS_writeSBE64;
220     da_PHYSFS_writeUBE64 PHYSFS_writeUBE64;
221     da_PHYSFS_isInit PHYSFS_isInit;
222     da_PHYSFS_symbolicLinksPermitted PHYSFS_symbolicLinksPermitted;
223     da_PHYSFS_setAllocator PHYSFS_setAllocator;
224     da_PHYSFS_mount PHYSFS_mount;
225     da_PHYSFS_getMountPoint PHYSFS_getMountPoint;
226     da_PHYSFS_getCdRomDirsCallback PHYSFS_getCdRomDirsCallback;
227     da_PHYSFS_getSearchPathCallback PHYSFS_getSearchPathCallback;
228     da_PHYSFS_enumerateFilesCallback PHYSFS_enumerateFilesCallback;
229     da_PHYSFS_utf8FromUcs4 PHYSFS_utf8FromUcs4;
230     da_PHYSFS_utf8ToUcs4 PHYSFS_utf8ToUcs4;
231     da_PHYSFS_utf8FromUcs2 PHYSFS_utf8FromUcs2;
232     da_PHYSFS_utf8ToUcs2 PHYSFS_utf8ToUcs2;
233     da_PHYSFS_utf8FromLatin1 PHYSFS_utf8FromLatin1;
234 
235     da_PHYSFS_unmount PHYSFS_unmount;
236     da_PHYSFS_getAllocator PHYSFS_getAllocator;
237     da_PHYSFS_stat PHYSFS_stat;
238     da_PHYSFS_utf8FromUtf16 PHYSFS_utf8FromUtf16;
239     da_PHYSFS_utf8ToUtf16 PHYSFS_utf8ToUtf16;
240     da_PHYSFS_readBytes PHYSFS_readBytes;
241     da_PHYSFS_writeBytes PHYSFS_writeBytes;
242     da_PHYSFS_mountIo PHYSFS_mountIo;
243     da_PHYSFS_mountMemory PHYSFS_mountMemory;
244     da_PHYSFS_mountHandle PHYSFS_mountHandle;
245     da_PHYSFS_getLastErrorCode PHYSFS_getLastErrorCode;
246     da_PHYSFS_getErrorByCode PHYSFS_getErrorByCode;
247     da_PHYSFS_setErrorCode PHYSFS_setErrorCode;
248     da_PHYSFS_getPrefDir PHYSFS_getPrefDir;
249     da_PHYSFS_registerArchiver PHYSFS_registerArchiver;
250     da_PHYSFS_deregisterArchiver PHYSFS_deregisterArchiver;
251 }
252 
253 class DerelictPHYSFSLoader : SharedLibLoader {
254     this() 
255     {
256         super( libNames );
257     }
258 
259     protected override void loadSymbols() 
260     {
261         bindFunc(cast(void**)&PHYSFS_getLinkedVersion, "PHYSFS_getLinkedVersion");
262         bindFunc(cast(void**)&PHYSFS_init, "PHYSFS_init");
263         bindFunc(cast(void**)&PHYSFS_deinit, "PHYSFS_deinit");
264         bindFunc(cast(void**)&PHYSFS_supportedArchiveTypes, "PHYSFS_supportedArchiveTypes");
265         bindFunc(cast(void**)&PHYSFS_freeList, "PHYSFS_freeList");
266         bindFunc(cast(void**)&PHYSFS_getLastError, "PHYSFS_getLastError");
267         bindFunc(cast(void**)&PHYSFS_getDirSeparator, "PHYSFS_getDirSeparator");
268         bindFunc(cast(void**)&PHYSFS_permitSymbolicLinks, "PHYSFS_permitSymbolicLinks");
269         bindFunc(cast(void**)&PHYSFS_getCdRomDirs, "PHYSFS_getCdRomDirs");
270         bindFunc(cast(void**)&PHYSFS_getBaseDir, "PHYSFS_getBaseDir");
271         bindFunc(cast(void**)&PHYSFS_getUserDir, "PHYSFS_getUserDir");
272         bindFunc(cast(void**)&PHYSFS_getWriteDir, "PHYSFS_getWriteDir");
273         bindFunc(cast(void**)&PHYSFS_setWriteDir, "PHYSFS_setWriteDir");
274         bindFunc(cast(void**)&PHYSFS_addToSearchPath, "PHYSFS_addToSearchPath");
275         bindFunc(cast(void**)&PHYSFS_removeFromSearchPath, "PHYSFS_removeFromSearchPath");
276         bindFunc(cast(void**)&PHYSFS_getSearchPath, "PHYSFS_getSearchPath");
277         bindFunc(cast(void**)&PHYSFS_setSaneConfig, "PHYSFS_setSaneConfig");
278         bindFunc(cast(void**)&PHYSFS_mkdir, "PHYSFS_mkdir");
279         bindFunc(cast(void**)&PHYSFS_delete, "PHYSFS_delete");
280         bindFunc(cast(void**)&PHYSFS_getRealDir, "PHYSFS_getRealDir");
281         bindFunc(cast(void**)&PHYSFS_enumerateFiles, "PHYSFS_enumerateFiles");
282         bindFunc(cast(void**)&PHYSFS_exists, "PHYSFS_exists");
283         bindFunc(cast(void**)&PHYSFS_isDirectory, "PHYSFS_isDirectory");
284         bindFunc(cast(void**)&PHYSFS_isSymbolicLink, "PHYSFS_isSymbolicLink");
285         bindFunc(cast(void**)&PHYSFS_getLastModTime, "PHYSFS_getLastModTime");
286         bindFunc(cast(void**)&PHYSFS_openWrite, "PHYSFS_openWrite");
287         bindFunc(cast(void**)&PHYSFS_openAppend, "PHYSFS_openAppend");
288         bindFunc(cast(void**)&PHYSFS_openRead, "PHYSFS_openRead");
289         bindFunc(cast(void**)&PHYSFS_close, "PHYSFS_close");
290         bindFunc(cast(void**)&PHYSFS_read, "PHYSFS_read");
291         bindFunc(cast(void**)&PHYSFS_write, "PHYSFS_write");
292         bindFunc(cast(void**)&PHYSFS_eof, "PHYSFS_eof");
293         bindFunc(cast(void**)&PHYSFS_tell, "PHYSFS_tell");
294         bindFunc(cast(void**)&PHYSFS_seek, "PHYSFS_seek");
295         bindFunc(cast(void**)&PHYSFS_fileLength, "PHYSFS_fileLength");
296         bindFunc(cast(void**)&PHYSFS_setBuffer, "PHYSFS_setBuffer");
297         bindFunc(cast(void**)&PHYSFS_flush, "PHYSFS_flush");
298         bindFunc(cast(void**)&PHYSFS_swapSLE16, "PHYSFS_swapSLE16");
299         bindFunc(cast(void**)&PHYSFS_swapULE16, "PHYSFS_swapULE16");
300         bindFunc(cast(void**)&PHYSFS_swapSLE32, "PHYSFS_swapSLE32");
301         bindFunc(cast(void**)&PHYSFS_swapULE32, "PHYSFS_swapULE32");
302         bindFunc(cast(void**)&PHYSFS_swapSLE64, "PHYSFS_swapSLE64");
303         bindFunc(cast(void**)&PHYSFS_swapULE64, "PHYSFS_swapULE64");
304         bindFunc(cast(void**)&PHYSFS_swapSBE16, "PHYSFS_swapSBE16");
305         bindFunc(cast(void**)&PHYSFS_swapUBE16, "PHYSFS_swapUBE16");
306         bindFunc(cast(void**)&PHYSFS_swapSBE32, "PHYSFS_swapSBE32");
307         bindFunc(cast(void**)&PHYSFS_swapUBE32, "PHYSFS_swapUBE32");
308         bindFunc(cast(void**)&PHYSFS_swapSBE64, "PHYSFS_swapSBE64");
309         bindFunc(cast(void**)&PHYSFS_swapUBE64, "PHYSFS_swapUBE64");
310         bindFunc(cast(void**)&PHYSFS_readSLE16, "PHYSFS_readSLE16");
311         bindFunc(cast(void**)&PHYSFS_readULE16, "PHYSFS_readULE16");
312         bindFunc(cast(void**)&PHYSFS_readSLE32, "PHYSFS_readSLE32");
313         bindFunc(cast(void**)&PHYSFS_readULE32, "PHYSFS_readULE32");
314         bindFunc(cast(void**)&PHYSFS_readSLE64, "PHYSFS_readSLE64");
315         bindFunc(cast(void**)&PHYSFS_readULE64, "PHYSFS_readULE64");
316         bindFunc(cast(void**)&PHYSFS_readSBE16, "PHYSFS_readSBE16");
317         bindFunc(cast(void**)&PHYSFS_readUBE16, "PHYSFS_readUBE16");
318         bindFunc(cast(void**)&PHYSFS_readSBE32, "PHYSFS_readSBE32");
319         bindFunc(cast(void**)&PHYSFS_readUBE32, "PHYSFS_readUBE32");
320         bindFunc(cast(void**)&PHYSFS_readSBE64, "PHYSFS_readSBE64");
321         bindFunc(cast(void**)&PHYSFS_readUBE64, "PHYSFS_readUBE64");
322         bindFunc(cast(void**)&PHYSFS_writeSLE16, "PHYSFS_writeSLE16");
323         bindFunc(cast(void**)&PHYSFS_writeULE16, "PHYSFS_writeULE16");
324         bindFunc(cast(void**)&PHYSFS_writeSLE32, "PHYSFS_writeSLE32");
325         bindFunc(cast(void**)&PHYSFS_writeULE32, "PHYSFS_writeULE32");
326         bindFunc(cast(void**)&PHYSFS_writeSLE64, "PHYSFS_writeSLE64");
327         bindFunc(cast(void**)&PHYSFS_writeULE64, "PHYSFS_writeULE64");
328         bindFunc(cast(void**)&PHYSFS_writeSBE16, "PHYSFS_writeSBE16");
329         bindFunc(cast(void**)&PHYSFS_writeUBE16, "PHYSFS_writeUBE16");
330         bindFunc(cast(void**)&PHYSFS_writeSBE32, "PHYSFS_writeSBE32");
331         bindFunc(cast(void**)&PHYSFS_writeUBE32, "PHYSFS_writeUBE32");
332         bindFunc(cast(void**)&PHYSFS_writeSBE64, "PHYSFS_writeSBE64");
333         bindFunc(cast(void**)&PHYSFS_writeUBE64, "PHYSFS_writeUBE64");
334         bindFunc(cast(void**)&PHYSFS_isInit, "PHYSFS_isInit");
335         bindFunc(cast(void**)&PHYSFS_symbolicLinksPermitted, "PHYSFS_symbolicLinksPermitted");
336         bindFunc(cast(void**)&PHYSFS_setAllocator, "PHYSFS_setAllocator");
337         bindFunc(cast(void**)&PHYSFS_mount, "PHYSFS_mount");
338         bindFunc(cast(void**)&PHYSFS_getMountPoint, "PHYSFS_getMountPoint");
339         bindFunc(cast(void**)&PHYSFS_getCdRomDirsCallback, "PHYSFS_getCdRomDirsCallback");
340         bindFunc(cast(void**)&PHYSFS_getSearchPathCallback, "PHYSFS_getSearchPathCallback");
341         bindFunc(cast(void**)&PHYSFS_enumerateFilesCallback, "PHYSFS_enumerateFilesCallback");
342         bindFunc(cast(void**)&PHYSFS_utf8FromUcs4, "PHYSFS_utf8FromUcs4");
343         bindFunc(cast(void**)&PHYSFS_utf8ToUcs4, "PHYSFS_utf8ToUcs4");
344         bindFunc(cast(void**)&PHYSFS_utf8FromUcs2, "PHYSFS_utf8FromUcs2");
345         bindFunc(cast(void**)&PHYSFS_utf8ToUcs2, "PHYSFS_utf8ToUcs2");
346         bindFunc(cast(void**)&PHYSFS_utf8FromLatin1, "PHYSFS_utf8FromLatin1");
347 
348         bindFunc(cast(void**)&PHYSFS_unmount, "PHYSFS_unmount");
349         bindFunc(cast(void**)&PHYSFS_getAllocator, "PHYSFS_getAllocator");
350         bindFunc(cast(void**)&PHYSFS_stat, "PHYSFS_stat");
351         bindFunc(cast(void**)&PHYSFS_utf8FromUtf16, "PHYSFS_utf8FromUtf16");
352         bindFunc(cast(void**)&PHYSFS_utf8ToUtf16, "PHYSFS_utf8ToUtf16");
353         bindFunc(cast(void**)&PHYSFS_readBytes, "PHYSFS_readBytes");
354         bindFunc(cast(void**)&PHYSFS_writeBytes, "PHYSFS_writeBytes");
355         bindFunc(cast(void**)&PHYSFS_mountIo, "PHYSFS_mountIo");
356         bindFunc(cast(void**)&PHYSFS_mountMemory, "PHYSFS_mountMemory");
357         bindFunc(cast(void**)&PHYSFS_mountHandle, "PHYSFS_mountHandle");
358         bindFunc(cast(void**)&PHYSFS_getLastErrorCode, "PHYSFS_getLastErrorCode");
359         bindFunc(cast(void**)&PHYSFS_getErrorByCode, "PHYSFS_getErrorByCode");
360         bindFunc(cast(void**)&PHYSFS_setErrorCode, "PHYSFS_setErrorCode");
361         bindFunc(cast(void**)&PHYSFS_getPrefDir, "PHYSFS_getPrefDir");
362         bindFunc(cast(void**)&PHYSFS_registerArchiver, "PHYSFS_registerArchiver");
363         bindFunc(cast(void**)&PHYSFS_deregisterArchiver, "PHYSFS_deregisterArchiver");
364     }
365 }
366 
367 __gshared DerelictPHYSFSLoader DerelictPHYSFS;
368 
369 shared static this() 
370 {
371     DerelictPHYSFS = new DerelictPHYSFSLoader;
372 }
373 
374 private:
375     static if(Derelict_OS_Windows)
376         enum libNames = "libphysfs.dll, physfs.dll";
377     else static if(Derelict_OS_Mac)
378         enum libNames = "libphysfs.dylib, /usr/local/lib/libphysfs.dylib";
379     else static if(Derelict_OS_Posix)
380         enum libNames = "libphysfs.so,/usr/local/lib/libphysfs.so";
381     else
382         static assert(0, "Need to implement PhysFS libNames for this operating system.");