1 /* 2 The MIT License (MIT) 3 4 Copyright (c) 2015 Stephan Dilly 5 6 Permission is hereby granted, free of charge, to any person obtaining a copy 7 of this software and associated documentation files (the "Software"), to deal 8 in the Software without restriction, including without limitation the rights 9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 copies of the Software, and to permit persons to whom the Software is 11 furnished to do so, subject to the following conditions: 12 13 The above copyright notice and this permission notice shall be included in all 14 copies or substantial portions of the Software. 15 16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 SOFTWARE. 23 */ 24 module derelict.cf.cf; 25 26 public 27 { 28 import derelict.cf.types; 29 import derelict.cf.funcs; 30 } 31 32 private 33 { 34 import derelict.util.loader; 35 36 version(darwin) 37 version = MacOSX; 38 version(OSX) 39 version = MacOSX; 40 } 41 42 private 43 { 44 import derelict.util.loader; 45 import derelict.util.system; 46 47 static if (Derelict_OS_Mac) 48 enum libNames = "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation"; 49 else 50 static assert(0, "No implemenation of this lib on this OS"); 51 } 52 53 final class DerelictCFLoader : SharedLibLoader 54 { 55 protected 56 { 57 override void loadSymbols() 58 { 59 bindFunc(cast(void**)&CFBundleGetMainBundle, "CFBundleGetMainBundle"); 60 bindFunc(cast(void**)&CFBundleCopyResourcesDirectoryURL, "CFBundleCopyResourcesDirectoryURL"); 61 bindFunc(cast(void**)&CFURLGetFileSystemRepresentation, "CFURLGetFileSystemRepresentation"); 62 bindFunc(cast(void**)&CFRelease, "CFRelease"); 63 } 64 } 65 66 public 67 { 68 this() 69 { 70 super(libNames); 71 } 72 } 73 } 74 75 __gshared DerelictCFLoader DerelictCF; 76 77 shared static this() 78 { 79 DerelictCF = new DerelictCFLoader(); 80 }