TITLE: ensuring consistent header files (Source: comp.lang.c++, 30 May 2001) WAIBEL: Larry R. Waibel > I am building a library and need to find an automated way to insure that the > header files that the user application uses when it compiles are the same as > those used when the library version they're linking with was built. Anyone > have some ideas on how best to do this? Thanks! KUEHL: "Dietmar Kuehl" That's pretty simple: Define everything you have in a namespace whose name encodes the version of the library. At the end of the headers, you provide a namespace alias for easy use (I think you can have duplicate namespace aliases; if you cannot, you would have to protect it using eg. a simple macro or something like this): namespace library_20010530 { // declarations go here } namespace library = library_20010530; The mangled names of the used symbols will include the library version (in this case just an ISO date) and will link only if the names in the library match. Pretty simple, isn't it? _______________________________________________ cpptips mailing list http://cpptips.hyperformix.com