[Issue 983] New: constant cfstrings for Darwin

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 19 06:09:55 PST 2007


http://d.puremagic.com/issues/show_bug.cgi?id=983

           Summary: constant cfstrings for Darwin
           Product: DGCC aka GDC
           Version: unspecified
          Platform: Macintosh
        OS/Version: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: glue layer
        AssignedTo: dvdfrdmn at users.sf.net
        ReportedBy: afb at algonet.se


When doing Carbon programming for Mac OS X, there are two possible ways to
create constant strings for CoreFoundation - both use the CFSTR() macro from
CFString.h. It would be nice if the __CFStringMakeConstantString built-in could
be made available to D (same as for C/C++), to avoid having to do the runtime
call.

I've introduced a version(GNU_Constant_CFStrings) that matches the macro
__CONSTANT_CFSTRINGS__ that C/C++ uses to check the current setting. But we
still need the built-in function for __CFStringMakeConstantString, and I assume
that GCC also needs the type somehow (it's a struct pointer, maybe a void* will
do)


darwin.c:

  /* struct __builtin_CFString {
       const int *isa;          (will point at
       int flags;                __CFConstantStringClassReference)
       const char *str;
       int length;
     };  */

  /* const struct __builtin_CFstring *
     __builtin___CFStringMakeConstantString (const char *); */


-- 



More information about the D.gnu mailing list