| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
Message: 14
From: "Pietrzak, Bryan" <email@hidden>
To: email@hidden
Subject: RE: static CFSTR in C
Date: Wed, 27 Aug 2003 13:44:02 -0600
Hmm, after reading the other e-mails I thought there must be something I'm
missing.
So I went and added in Globals.cp
CFStringRef gSomething = CFSTR("Something");
And in Globals.h I added
extern CFStringRef gSomething;And then in my main I added length = CFStringGetLength(gSomething); and the
result was 9.
What I am missing about declaring global CFStrings that people would go to
any more trouble that this? I had no problem at all using this outside of a
function. This has been true in both CFM and mach-o apps.
Bryan
----------
From: Pietrzak, Bryan
Sent: Wednesday, August 27, 2003 12:28 PM
To: email@hidden; 'Marc Poirier'
Subject: RE: static CFSTR in C
Doesn't this work?
In "globals.cp"
static CFStringRef gSomething = CFSTR("Something");
In globals.h
extern CFStringRef gSomething;
Note that a CFStringRef is implicitly const -- it's not a
CFMutableStringRef
Bryan
----------in
From: Marc Poirier
Sent: Wednesday, August 27, 2003 11:51 AM
To: email@hidden
Subject: static CFSTR in C
Hi. I was wondering, is there a way to use CFSTR for a global variable
C? Does something like this (outside of a function):
static const CFStringRef blah = CFSTR("blah");
results in this error:
error: initializer element is not constant
Do I need to use __attribute__((constructor)) or something else, or is
there some CoreFoundation trick to use?
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.