Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mac OS X version at compile-time



Does anyone know of a convenient way to determine at compile-time (C preprocessor time, actually) which version of headers are being used? I know there are macros in "AvailabilityMacros.h" but that's not applicable to the problem I have.

I'm trying to adapt an open-source project for Max OS X. This will then be built by various developers as needed, on varying OSs and versions.

Most of this is OK but I ran into a problem with a change to <sys/socket.h>

In early versions, there is not typedef for "socklen_t". But in OS X 10.2 and later, there is this definition ...

/*
 * Data types.
 */
typedef u_char		sa_family_t;
#ifdef	_BSD_SOCKLEN_T_
typedef	_BSD_SOCKLEN_T_	socklen_t;
#undef	_BSD_SOCKLEN_T_
#endif

So, my code which includes <sys/socket.h> cannot determine whether it is defined or not. I think an easy solution for this would have been to add
#define SOCKLEN_T_DEFINED
in the block, but that opportunity has passed us by. The only way I can see is to check the version of the headers being used.


So, is there a #define somewhere which I can test?? Or a more appropriate solution?

Thanks.....Peter

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden


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.