On Mon, Feb 1, 2010 at 16:45, Tom Browder <[email protected]> wrote: > I am now running into a situation where my development system is using > the latest release of BRL-CAD (7.16.4) and my remote team mate is > using an older one (7.12.6) and some function signatures have changed. > Specifically, > > void rt_db_free_internal(struct rt_db_internal *ip, struct resource *resp); > > became > > void rt_db_free_internal(struct rt_db_internal *ip); > > and g++ 4.4.3 doesn't like that. I have found no clean way to use a > compile-time cpp macro to distinguish the two versions but would > appreciate any ideas. I know my team mate needs to upgrade, but that > isn't in the cards at the moment. > > Note there is a PACKAGE_VERSION defined as a string but I don't think > you can use that at compile time (at least I haven't found a solution > looking at the cpp manual). > > I think we need something like gcc and others use: > > #define BRLCAD_MAJOR_VERSION 7 > #define BRLCAD_MINOR_VERSION 16 > #define BRLCAD_PATCH_VERSION 4 > > From the cpp manual (4.4.3), gcc defines three macros > > __GNUC__ // major version > __GNUC_MINOR__ > __GNUC_PATCHLEVEL__ > > and they show a couple of ways to test for a specific version. I like > this method: > > #define GCC_VERSION (__GNUC__ * 10000 \ > + __GNUC_MINOR__ * 100 \ > + __GNUC_PATCHLEVEL__) > > /* Test for GCC > 3.2.0 */ > #if GCC_VERSION > 30200
Attached is an m4 source file to be input to m4 to generate a special header file in the include directory to satisfy my itch to have some cpp-usable macros for conditional compilation. Note that it doesn't have to be used by anyone, but it does do the job if anyone wants to use it. Note that the m4 file is fragile unless you really know what you are doing (and it was hit and miss for me even with help from the boys on the m4 mailing list--everyone has a different idea). I have tried to get it into the build system but haven't succeeded yet; however, I have a simple Makefile attached for testing. Regards, -Tom Thomas M. Browder, Jr. Niceville, Florida USA
brlcad_version_defines.m4
Description: Binary data
Makefile.tb
Description: Binary data
------------------------------------------------------------------------------ This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________ BRL-CAD Developer mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/brlcad-devel
