Re: Using agvtool's generated version info file?
Re: Using agvtool's generated version info file?
- Subject: Re: Using agvtool's generated version info file?
- From: Christiaan Hofman <email@hidden>
- Date: Mon, 16 Aug 2010 13:52:18 +0200
On Aug 16, 2010, at 13:35, Rainer Brockerhoff wrote:
> At 03:04 -0700 16/08/10, email@hidden wrote:
>> From: Christiaan Hofman <email@hidden>
>> References: <email@hidden>
>> In-Reply-To: <email@hidden>
>> Date: Mon, 16 Aug 2010 12:03:17 +0200
>> Message-ID: <email@hidden>
>>
>> On Aug 16, 2010, at 11:47, Nicholas Helke wrote:
>>> I'm relatively new to agvtool. I've got everything working the way I want, except:
>>>
>>> I'm trying to figure out how best to include the generated VERSION_INFO_FILE (Located at build/$(PRODUCT_NAME).build/$(ACTIVE_CONFIGURATION)/$(PRODUCT_NAME).build/DerivedSources/$(PRODUCT_NAME)_vers.c) in my Xcode project so I can access the two constants it sets.
>>> Nicholas Helke
>>
>> You should never have to access that file explicitly, Apple's code does that implicitly. If you need the version number in your code you should get it from the info dictionary from the mainBundle.
>
> Not quite. (And the version string isn't in the info dictionary, too.)
>
Typically you would set the version string to something like that, i.e. CFBundleVersion = ${CURRENT_PROJECT_VERSION}. Anyway, the version string(s) should be only thing that should be relevant for your code.
> If you look at that file it's something like this:
> const unsigned char XYZVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:XYZ PROJECT:XYZ-101" "\n";
> const double XYZVersionNumber __attribute__ ((used)) = (double)101.;
> where "XYZ" is your project name, and 101 your version.
>
> So you can access those constants by including
> extern const unsigned char XYZVersionString[];
> extern const double XYZVersionNumber;
> in the file where you want to access them, and the linker will find them for you.
>
> HTH,
The fact that they exist and you can do that does not mean that you SHOULD have a use for them (and that's what I said, I never said you can't). AFAIK they're there only to have these symbols in the binary, for debugging purposes. They're not meant for actual use. Otherwise there would be a header file to advertise them, or at least some documentation.
So really my reply should be: why WOULD you want that?
Christiaan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden