casseopea2 / gperftools

Automatically exported from code.google.com/p/gperftools
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Need version macros in dev headers and version API #167

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Application that depends on tcmalloc would like to find out which version
the tcmalloc is, so it can warn about old versions at build/configure phase
and whether there is a mismatch between headers and libraries.

Something like TC_VERSION macros and tc_version() a la Berkeley DB headers
would be great.

Original issue reported on code.google.com by vic...@gmail.com on 5 Sep 2009 at 12:46

GoogleCodeExporter commented 9 years ago
Good idea!  I'll look into getting tc_version (but probably not TC_VERSION, 
since I'd
rather avoid macros until there's an identified need for it) into the next 
release.

Original comment by csilv...@gmail.com on 10 Sep 2009 at 8:45

GoogleCodeExporter commented 9 years ago
Both (macros and API) are needed for checking header/library mismatch, 
especially for
shared libraries. Such mismatch (header has different struct size/members or 
function
arguments than those in the library) can lead to crashes that are hard to track 
down,
especially for C linkage, where only function names are used at link time.

Original comment by vic...@gmail.com on 10 Sep 2009 at 9:24

GoogleCodeExporter commented 9 years ago
OK, I can look into adding a macro.  I couldn't find any documentation of 
DB_VERSION
from libdb; can you point me to what you were thinking the macro should look 
like?

Original comment by csilv...@gmail.com on 10 Sep 2009 at 10:02

GoogleCodeExporter commented 9 years ago
Excerpts from /usr/include/db.h:

/*
 * Berkeley DB version information.
 */
#define DB_VERSION_MAJOR        4
#define DB_VERSION_MINOR        7
#define DB_VERSION_PATCH        25
#define DB_VERSION_STRING       "Berkeley DB 4.7.25: (May 15, 2008)"

char *db_version __P((int *major, int *minor, int *patch));

Original comment by vic...@gmail.com on 10 Sep 2009 at 10:34

GoogleCodeExporter commented 9 years ago
I've added a similar set of macros and functions to perftools 1.4, just 
released.

Original comment by csilv...@gmail.com on 11 Sep 2009 at 7:00