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 /* 25 * Copyright (c) 2015 Guillaume Piolat 26 * All rights reserved. 27 * 28 * Redistribution and use in source and binary forms, with or without 29 * modification, are permitted provided that the following conditions are 30 * met: 31 * 32 * * Redistributions of source code must retain the above copyright 33 * notice, this list of conditions and the following disclaimer. 34 * 35 * * Redistributions in binary form must reproduce the above copyright 36 * notice, this list of conditions and the following disclaimer in the 37 * documentation and/or other materials provided with the distribution. 38 * 39 * * Neither the names 'Derelict', 'DerelictSDL', nor the names of its contributors 40 * may be used to endorse or promote products derived from this software 41 * without specific prior written permission. 42 * 43 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 44 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 45 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 46 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 47 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 48 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 49 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 50 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 51 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 52 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 53 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 54 */ 55 /** 56 Dynamic bindings to the CoreFoundation framework. 57 */ 58 module derelict.carbon.corefoundation; 59 60 import core.stdc.config; 61 62 import dplug.core.sharedlib; 63 import dplug.core.nogc; 64 65 version(OSX) 66 enum libNames = "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation"; 67 else 68 enum libNames = ""; 69 70 71 class DerelictCoreFoundationLoader : SharedLibLoader 72 { 73 public 74 { 75 nothrow @nogc: 76 this() 77 { 78 super(libNames); 79 } 80 81 override void loadSymbols() 82 { 83 bindFunc(cast(void**)&CFRetain, "CFRetain"); 84 bindFunc(cast(void**)&CFRelease, "CFRelease"); 85 bindFunc(cast(void**)&CFEqual, "CFEqual"); 86 bindFunc(cast(void**)&CFHash, "CFHash"); 87 bindFunc(cast(void**)&CFCopyDescription, "CFCopyDescription"); 88 89 bindFunc(cast(void**)&CFArrayCreateMutable, "CFArrayCreateMutable"); 90 bindFunc(cast(void**)&CFArrayAppendValue, "CFArrayAppendValue"); 91 92 bindFunc(cast(void**)&CFAllocatorAllocate, "CFAllocatorAllocate"); 93 bindFunc(cast(void**)&CFAllocatorDeallocate, "CFAllocatorDeallocate"); 94 95 bindFunc(cast(void**)&CFBundleGetMainBundle, "CFBundleGetMainBundle"); 96 bindFunc(cast(void**)&CFBundleGetBundleWithIdentifier, "CFBundleGetBundleWithIdentifier"); 97 bindFunc(cast(void**)&CFBundleCopyBundleURL, "CFBundleCopyBundleURL"); 98 bindFunc(cast(void**)&CFBundleCopyResourcesDirectoryURL, "CFBundleCopyResourcesDirectoryURL"); 99 100 bindFunc(cast(void**)&CFURLGetFileSystemRepresentation, "CFURLGetFileSystemRepresentation"); 101 102 bindFunc(cast(void**)&CFStringCreateWithCString, "CFStringCreateWithCString"); 103 bindFunc(cast(void**)&CFStringGetLength, "CFStringGetLength"); 104 bindFunc(cast(void**)&CFStringGetCString, "CFStringGetCString"); 105 bindFunc(cast(void**)&CFStringCreateCopy, "CFStringCreateCopy"); 106 bindFunc(cast(void**)&CFStringCompare, "CFStringCompare"); 107 bindFunc(cast(void**)&CFStringCreateWithFormat, "CFStringCreateWithFormat"); 108 109 bindFunc(cast(void**)&CFDataCreate, "CFDataCreate"); 110 bindFunc(cast(void**)&CFDataGetLength, "CFDataGetLength"); 111 bindFunc(cast(void**)&CFDataGetBytePtr, "CFDataGetBytePtr"); 112 113 bindFunc(cast(void**)&CFDictionaryCreateMutable, "CFDictionaryCreateMutable"); 114 bindFunc(cast(void**)&CFDictionaryGetValue, "CFDictionaryGetValue"); 115 bindFunc(cast(void**)&CFDictionarySetValue, "CFDictionarySetValue"); 116 117 bindFunc(cast(void**)&CFNumberCreate, "CFNumberCreate"); 118 bindFunc(cast(void**)&CFNumberGetValue, "CFNumberGetValue"); 119 120 with (kCFTypeArrayCallBacks) 121 { 122 version_ = 0; 123 retain = &myRetainCallBack; 124 release = &myReleaseCallBack; 125 copyDescription = CFCopyDescription; 126 equal = CFEqual; 127 } 128 129 with (kCFTypeDictionaryKeyCallBacks) 130 { 131 version_ = 0; 132 retain = &myRetainCallBack; 133 release = &myReleaseCallBack; 134 copyDescription = CFCopyDescription; 135 equal = CFEqual; 136 hash = CFHash; 137 } 138 139 with (kCFTypeDictionaryValueCallBacks) 140 { 141 version_ = 0; 142 retain = &myRetainCallBack; 143 release = &myReleaseCallBack; 144 copyDescription = CFCopyDescription; 145 equal = CFEqual; 146 } 147 } 148 } 149 } 150 151 private __gshared DerelictCoreFoundationLoader DerelictCoreFoundation; 152 153 private __gshared loaderCounterCF = 0; 154 155 // Call this each time a novel owner uses these functions 156 // TODO: hold a mutex, because this isn't thread-safe 157 void acquireCoreFoundationFunctions() nothrow @nogc 158 { 159 if (DerelictCoreFoundation is null) // You only live once 160 { 161 DerelictCoreFoundation = mallocNew!DerelictCoreFoundationLoader(); 162 DerelictCoreFoundation.load(); 163 } 164 } 165 166 // Call this each time a novel owner releases a Cocoa functions 167 // TODO: hold a mutex, because this isn't thread-safe 168 void releaseCoreFoundationFunctions() nothrow @nogc 169 { 170 /*if (--loaderCounterCF == 0) 171 { 172 DerelictCoreFoundation.unload(); 173 DerelictCoreFoundation.destroyFree(); 174 }*/ 175 } 176 177 unittest 178 { 179 version(OSX) 180 { 181 acquireCoreFoundationFunctions(); 182 releaseCoreFoundationFunctions(); 183 } 184 } 185 186 // To support character constants 187 package int CCONST(int a, int b, int c, int d) pure nothrow 188 { 189 return (a << 24) | (b << 16) | (c << 8) | (d << 0); 190 } 191 192 193 // <MacTypes.h> 194 195 alias UInt8 = ubyte; 196 alias SInt8 = byte; 197 alias UInt16 = ushort; 198 alias SInt16 = short; 199 alias UInt32 = uint; 200 alias SInt32 = int; 201 alias UInt64 = ulong; 202 alias SInt64 = long; 203 204 205 // binary layout should be what is expected on this platform 206 version (LittleEndian) 207 { 208 struct wide 209 { 210 UInt32 lo; 211 SInt32 hi; 212 } 213 214 struct UnsignedWide 215 { 216 UInt32 lo; 217 UInt32 hi; 218 } 219 } 220 else 221 { 222 struct wide 223 { 224 SInt32 hi; 225 UInt32 lo; 226 } 227 228 struct UnsignedWide 229 { 230 UInt32 hi; 231 UInt32 lo; 232 } 233 } 234 235 236 alias Fixed = SInt32; 237 alias FixedPtr = Fixed*; 238 alias Fract = SInt32; 239 alias FractPtr = Fract*; 240 alias UnsignedFixed = UInt32; 241 alias UnsignedFixedPtr = UnsignedFixed*; 242 alias ShortFixed = short; 243 alias ShortFixedPtr = ShortFixed*; 244 245 alias Float32 = float; 246 alias Float64 = double; 247 248 struct Float32Point 249 { 250 Float32 x; 251 Float32 y; 252 } 253 254 alias Ptr = char*; 255 alias Handle = Ptr*; 256 alias Size = long; 257 258 259 alias OSErr = SInt16; 260 alias OSStatus = SInt32; 261 alias LogicalAddress = void*; 262 alias ConstLogicalAddress = const(void)*; 263 alias PhysicalAddress = void*; 264 alias BytePtr = UInt8*; 265 alias ByteCount = c_ulong; 266 alias ByteOffset = c_ulong; 267 alias Duration = SInt32; 268 alias AbsoluteTime = UnsignedWide; 269 alias OptionBits = UInt32; 270 alias ItemCount = c_ulong; 271 alias PBVersion = UInt32; 272 alias ScriptCode = SInt16; 273 alias LangCode = SInt16; 274 alias RegionCode = SInt16; 275 alias FourCharCode = UInt32; 276 alias OSType = FourCharCode; 277 alias ResType = FourCharCode; 278 alias OSTypePtr = OSType*; 279 alias ResTypePtr = ResType*; 280 281 enum 282 { 283 noErr = 0, 284 kNilOptions = 0, 285 kInvalidID = 0, 286 kVariableLengthArray = 1, 287 kUnknownType = 0x3F3F3F3F 288 } 289 290 alias UnicodeScalarValue = UInt32; 291 alias UTF32Char = UInt32; 292 alias UniChar = UInt16; 293 alias UTF16Char = UInt16; 294 alias UTF8Char = UInt8; 295 alias UniCharPtr = UniChar*; 296 alias UniCharCount = c_ulong; 297 alias UniCharCountPtr = UniCharCount*; 298 alias Str255 = char[256]; 299 alias Str63 = char[64]; 300 alias Str32 = char[33]; 301 alias Str31 = char[32]; 302 alias Str27 = char[28]; 303 alias Str15 = char[16]; 304 305 306 // <CoreFoundation/CFBase.h> 307 308 309 alias Boolean = ubyte; 310 311 alias StringPtr = char*; 312 alias ConstStringPtr = const(char)*; 313 alias ConstStr255Param = const(char)*; 314 alias Byte = UInt8; 315 alias SignedByte = SInt8; 316 317 318 alias CFTypeID = c_ulong; 319 alias CFOptionFlags = c_ulong; 320 alias CFHashCode = c_ulong; 321 alias CFIndex = c_long; 322 323 alias CFTypeRef = const(void)*; 324 325 alias CFStringRef = void*; 326 alias CFMutableStringRef = void*; 327 alias CFAllocatorRef = void*; 328 329 enum CFAllocatorRef kCFAllocatorDefault = null; 330 331 alias CFPropertyListRef = CFTypeRef; 332 333 334 struct CFRange 335 { 336 CFIndex location; 337 CFIndex length; 338 } 339 340 CFRange CFRangeMake(CFIndex loc, CFIndex len) 341 { 342 return CFRange(loc, len); 343 } 344 345 alias CFComparisonResult = CFIndex; 346 enum : CFComparisonResult 347 { 348 kCFCompareLessThan = -1, 349 kCFCompareEqualTo = 0, 350 kCFCompareGreaterThan = 1 351 } 352 353 alias CFNullRef = const(void)*; 354 355 struct Point 356 { 357 short v; 358 short h; 359 } 360 alias PointPtr = Point*; 361 362 struct Rect 363 { 364 short top; 365 short left; 366 short bottom; 367 short right; 368 } 369 alias RectPtr = Rect*; 370 371 extern(C) nothrow @nogc 372 { 373 alias da_CFRetain = CFTypeRef function(CFTypeRef cf); 374 alias da_CFRelease = void function(CFTypeRef cf); 375 alias da_CFEqual = Boolean function(CFTypeRef cf1, CFTypeRef cf2); 376 alias da_CFHash = CFHashCode function(CFTypeRef cf); 377 alias da_CFCopyDescription = CFStringRef function(CFTypeRef cf); 378 } 379 380 __gshared 381 { 382 da_CFRetain CFRetain; 383 da_CFRelease CFRelease; 384 da_CFEqual CFEqual; 385 da_CFHash CFHash; 386 da_CFCopyDescription CFCopyDescription; 387 } 388 389 390 extern(C) nothrow @nogc 391 { 392 alias da_CFAllocatorAllocate = void* function(CFAllocatorRef allocator, CFIndex size, CFOptionFlags hint); 393 alias da_CFAllocatorDeallocate = void function(CFAllocatorRef allocator, void *ptr); 394 } 395 396 __gshared 397 { 398 da_CFAllocatorAllocate CFAllocatorAllocate; 399 da_CFAllocatorDeallocate CFAllocatorDeallocate; 400 } 401 402 // <CoreFoundation/CFBundle.h> 403 404 alias CFBundleRef = void*; 405 406 extern(C) nothrow @nogc 407 { 408 alias da_CFBundleGetBundleWithIdentifier = CFBundleRef function(CFStringRef bundleID); 409 alias da_CFBundleCopyBundleURL = CFURLRef function(CFBundleRef bundle); 410 alias da_CFBundleGetMainBundle = CFBundleRef function(); 411 alias da_CFBundleCopyResourcesDirectoryURL = CFURLRef function(CFBundleRef bundle); 412 413 alias da_CFURLGetFileSystemRepresentation = Boolean function(CFURLRef url, Boolean resolveAgainstBase, UInt8* buffer, CFIndex maxBufLen); 414 } 415 416 __gshared 417 { 418 da_CFBundleGetBundleWithIdentifier CFBundleGetBundleWithIdentifier; 419 da_CFBundleCopyBundleURL CFBundleCopyBundleURL; 420 da_CFBundleGetMainBundle CFBundleGetMainBundle; 421 da_CFBundleCopyResourcesDirectoryURL CFBundleCopyResourcesDirectoryURL; 422 423 da_CFURLGetFileSystemRepresentation CFURLGetFileSystemRepresentation; 424 } 425 426 427 // <CoreFoundation/CFArray.h> 428 429 alias CFArrayRef = void*; 430 alias CFMutableArrayRef = void*; 431 432 extern(C) nothrow @nogc 433 { 434 alias CFArrayRetainCallBack = const(void)* function(CFAllocatorRef allocator, const(void)* value); 435 alias CFArrayReleaseCallBack = void function(CFAllocatorRef allocator, const(void)* value); 436 alias CFArrayEqualCallBack = Boolean function(const(void)* value1, const(void)* value2); 437 } 438 439 // This one isn't forced to be @nogc (this is arbitrary, only nothrow is needed) 440 extern(C) nothrow 441 { 442 alias CFArrayCopyDescriptionCallBack = CFStringRef function(const(void)* value); 443 } 444 445 struct CFArrayCallBacks 446 { 447 CFIndex version_; 448 CFArrayRetainCallBack retain; 449 CFArrayReleaseCallBack release; 450 CFArrayCopyDescriptionCallBack copyDescription; 451 CFArrayEqualCallBack equal; 452 } 453 454 __gshared CFArrayCallBacks kCFTypeArrayCallBacks; 455 456 extern(C) nothrow @nogc 457 { 458 alias da_CFArrayCreateMutable = CFMutableArrayRef function(CFAllocatorRef allocator, CFIndex capacity, const(CFArrayCallBacks)* callBacks); 459 alias da_CFArrayAppendValue = void function(CFMutableArrayRef theArray, const(void)* value); 460 } 461 462 __gshared 463 { 464 da_CFArrayCreateMutable CFArrayCreateMutable; 465 da_CFArrayAppendValue CFArrayAppendValue; 466 } 467 468 469 // <CoreFoundation/CFData.h> 470 471 alias CFDataRef = void*; 472 alias CFMutableDataRef = void*; 473 474 extern(C) nothrow @nogc 475 { 476 alias da_CFDataCreate = CFDataRef function(CFAllocatorRef allocator, const(UInt8)* bytes, CFIndex length); 477 478 alias da_CFDataGetLength = CFIndex function(CFDataRef theData); 479 alias da_CFDataGetBytePtr = const(UInt8)* function(CFDataRef theData); 480 } 481 482 __gshared 483 { 484 da_CFDataCreate CFDataCreate; 485 da_CFDataGetLength CFDataGetLength; 486 da_CFDataGetBytePtr CFDataGetBytePtr; 487 } 488 489 // <CoreFoundation/CFDictionary.h> 490 491 extern(C) nothrow @nogc 492 { 493 alias CFDictionaryRetainCallBack = const(void)* function(CFAllocatorRef allocator, const(void)* value); 494 alias CFDictionaryReleaseCallBack = void function(CFAllocatorRef allocator, const(void)* value); 495 alias CFDictionaryCopyDescriptionCallBack = CFStringRef function(const(void)* value); 496 alias CFDictionaryEqualCallBack = Boolean function(const(void)* value1, const(void)* value2); 497 alias CFDictionaryHashCallBack = CFHashCode function(const(void)* value); 498 } 499 500 501 // Dictionnaries callback 502 private extern(C) nothrow @nogc 503 { 504 const(void)* myRetainCallBack(CFAllocatorRef allocator, const(void)* value) 505 { 506 // MAYDO: not sure what to do with the allocator 507 return CFRetain(value); 508 } 509 510 void myReleaseCallBack(CFAllocatorRef allocator, const(void)* value) 511 { 512 // MAYDO: not sure what to do with the allocator 513 return CFRelease(value); 514 } 515 } 516 517 struct CFDictionaryKeyCallBacks 518 { 519 CFIndex version_; 520 CFDictionaryRetainCallBack retain; 521 CFDictionaryReleaseCallBack release; 522 CFDictionaryCopyDescriptionCallBack copyDescription; 523 CFDictionaryEqualCallBack equal; 524 CFDictionaryHashCallBack hash; 525 } 526 527 __gshared CFDictionaryKeyCallBacks kCFTypeDictionaryKeyCallBacks; 528 529 struct CFDictionaryValueCallBacks 530 { 531 CFIndex version_; 532 CFDictionaryRetainCallBack retain; 533 CFDictionaryReleaseCallBack release; 534 CFDictionaryCopyDescriptionCallBack copyDescription; 535 CFDictionaryEqualCallBack equal; 536 } 537 538 __gshared CFDictionaryValueCallBacks kCFTypeDictionaryValueCallBacks; 539 540 alias CFDictionaryRef = void*; 541 alias CFMutableDictionaryRef = void*; 542 543 extern(C) nothrow @nogc 544 { 545 alias da_CFDictionaryCreateMutable = CFMutableDictionaryRef function(CFAllocatorRef, CFIndex, const(CFDictionaryKeyCallBacks)*, const(CFDictionaryValueCallBacks)*); 546 alias da_CFDictionaryGetValue = const(void)* function(CFDictionaryRef theDict, const(void) *key); 547 alias da_CFDictionarySetValue = void function(CFMutableDictionaryRef theDict, const(void)* key, const(void)* value); 548 } 549 550 __gshared 551 { 552 da_CFDictionaryCreateMutable CFDictionaryCreateMutable; 553 da_CFDictionaryGetValue CFDictionaryGetValue; 554 da_CFDictionarySetValue CFDictionarySetValue; 555 } 556 557 // <CoreFoundation/CFNumber.h> 558 559 alias CFNumberRef = void*; 560 561 alias CFNumberType = CFIndex; 562 enum : CFNumberType 563 { 564 kCFNumberSInt8Type = 1, 565 kCFNumberSInt16Type = 2, 566 kCFNumberSInt32Type = 3, 567 kCFNumberSInt64Type = 4, 568 kCFNumberFloat32Type = 5, 569 kCFNumberFloat64Type = 6, 570 kCFNumberCharType = 7, 571 kCFNumberShortType = 8, 572 kCFNumberIntType = 9, 573 kCFNumberLongType = 10, 574 kCFNumberLongLongType = 11, 575 kCFNumberFloatType = 12, 576 kCFNumberDoubleType = 13, 577 kCFNumberCFIndexType = 14, 578 kCFNumberNSIntegerType = 15, 579 kCFNumberCGFloatType = 16, 580 kCFNumberMaxType = 16 581 } 582 583 extern(C) nothrow @nogc 584 { 585 alias da_CFNumberCreate = CFNumberRef function(CFAllocatorRef allocator, CFNumberType theType, const(void) *valuePtr); 586 alias da_CFNumberGetValue = Boolean function(CFNumberRef number, CFNumberType theType, void *valuePtr); 587 } 588 589 __gshared 590 { 591 da_CFNumberCreate CFNumberCreate; 592 da_CFNumberGetValue CFNumberGetValue; 593 } 594 595 // <CoreFoundation/CFString.h> 596 597 alias CFStringEncoding = UInt32; 598 alias CFStringBuiltInEncodings = CFStringEncoding; 599 enum : CFStringBuiltInEncodings 600 { 601 kCFStringEncodingMacRoman = 0, 602 kCFStringEncodingWindowsLatin1 = 0x0500, 603 kCFStringEncodingISOLatin1 = 0x0201, 604 kCFStringEncodingNextStepLatin = 0x0B01, 605 kCFStringEncodingASCII = 0x0600, 606 kCFStringEncodingUnicode = 0x0100, 607 kCFStringEncodingUTF8 = 0x08000100, 608 kCFStringEncodingNonLossyASCII = 0x0BFF, 609 610 kCFStringEncodingUTF16 = 0x0100, 611 kCFStringEncodingUTF16BE = 0x10000100, 612 kCFStringEncodingUTF16LE = 0x14000100, 613 614 kCFStringEncodingUTF32 = 0x0c000100, 615 kCFStringEncodingUTF32BE = 0x18000100, 616 kCFStringEncodingUTF32LE = 0x1c000100 617 } 618 619 alias CFStringCompareFlags = CFOptionFlags; 620 enum : CFStringCompareFlags 621 { 622 kCFCompareCaseInsensitive = 1, 623 kCFCompareBackwards = 4, 624 kCFCompareAnchored = 8, 625 kCFCompareNonliteral = 16, 626 kCFCompareLocalized = 32, 627 kCFCompareNumerically = 64, 628 kCFCompareDiacriticInsensitive = 128, 629 kCFCompareWidthInsensitive = 256, 630 kCFCompareForcedOrdering = 512 631 } 632 633 extern(C) nothrow @nogc 634 { 635 alias da_CFStringCreateWithCString = CFStringRef function(CFAllocatorRef, const(char)*, CFStringEncoding); 636 alias da_CFStringGetLength = CFIndex function(CFStringRef); 637 alias da_CFStringGetCString = Boolean function(CFStringRef, char*, CFIndex, CFStringEncoding); 638 alias da_CFStringCreateCopy = CFStringRef function(CFAllocatorRef alloc, CFStringRef theString); 639 alias da_CFStringCompare = CFComparisonResult function(CFStringRef theString1, CFStringRef theString2, CFStringCompareFlags compareOptions); 640 alias da_CFStringCreateWithFormat = CFStringRef function(CFAllocatorRef alloc, CFDictionaryRef formatOptions, CFStringRef format, ...); 641 } 642 643 __gshared 644 { 645 da_CFStringCreateWithCString CFStringCreateWithCString; 646 da_CFStringGetLength CFStringGetLength; 647 da_CFStringGetCString CFStringGetCString; 648 da_CFStringCreateCopy CFStringCreateCopy; 649 da_CFStringCompare CFStringCompare; 650 da_CFStringCreateWithFormat CFStringCreateWithFormat; 651 } 652 653 // <CoreFoundation/CFURL.h> 654 655 alias CFURLRef = void*;