[Liblas-devel] preprocessor symbols in public headers

Ed Hill ed at eh3.com
Tue Jan 18 20:47:16 EST 2011



Hi folks,

I'm trying to get libLAS packaged and included with Fedora & EPEL:

  https://bugzilla.redhat.com/show_bug.cgi?id=666301

and I've run into an issue involving the headers.  Basically, a fairly
standard build and install results in a few of the public headers
containing preprocessor symbols such as:

  #ifdef HAVE_GDAL
  #ifdef HAVE_LASZIP

Usually, within public header files it is considered maximally polite
(and safe!) to use only pre-processor symbols with a prefix or postfix
which makes them very unlikely to collide with the pre-processor symbols
used in unrelated code.  Unfortunately, the HAVE_GDAL and HAVE_LASZIP
symbols are very similar to ones typically used by Gnu autotools (and
other build systems) and are thus somewhat likely to result in
unintended symbol collisions.

So, are symbol collisions possible if the libLAS public headers are used
in conjunction with other projects?  Could they be a problem?  And, if
so, what is the best way to fix them?  Perhaps the symbols could have a
prefix or postfix to become something like:

  HAVE_GDAL  ==>  LIBLAS_HAVE_GDAL

Or is there a better approach?  Any help will be appreciated!

thanks,
Ed

-- 
Edward H. Hill III, PhD  |  ed at eh3.com  |  http://eh3.com/


More information about the Liblas-devel mailing list