[Biococoa-dev] string definitions

Charles PARNOT charles.parnot at stanford.edu
Mon Mar 21 15:06:53 EST 2005

At 6:39 -0500 3/21/05, Koen van der Drift wrote:
>On Mar 21, 2005, at 12:42 AM, Charles PARNOT wrote:
>>You can't define the value of a variable in a header and then call that header from multiple file. Otherwise, the compiler creates one variable for each implementation file and each compiled '.o' piece of code. What you are supposed to do is declare those variables in the header using extern, so the linker knows that these variables will exist. And then the values should be set in an implementation file. Constants have to be associated with one particular class. It should probably be in BCSymbol.m.
>>So the header should have
>>extern NSString *BCSymbolNameProperty;
>>and the implementation
>>NSString *BCSymbolNameProperty=@"Name";
>Well then that would defeat the purpose of one central file with all the strings defines, some of which might occur in more than one file. Maybe there is another construction possible to do such a thing?
>- Koen.

The header can still be separate from the BCSymbol header. But they should be set somewhere. It could in BCSymbol.m, or it could be in another file 'BCStringDefinitions.m'. When the framework is loaded, then all the global variables are loaded too, no matter where they are set.


Help science go fast forward:

Charles Parnot
charles.parnot at stanford.edu

Room  B157 in Beckman Center
279, Campus Drive
Stanford University
Stanford, CA 94305 (USA)

Tel +1 650 725 7754
Fax +1 650 725 8021

More information about the Biococoa-dev mailing list