Unable to use 1.8 API macro mappings

Hello -

I am unable to compile on Ubuntu using the supplied HDF5 library. The
headers seem to insist on using version 1.6.

For example, the file:

{{{
#if defined( H5_USE_16_API )
    @@@@
#endif
#include <hdf5.h>
#if defined( H5_USE_16_API )
    @@@@
#endif

void DatagroupOpenOrCreate( hid_t parentID, const char * const groupPath ) {
    hid_t groupID = H5Gcreate( parentID, groupPath, H5P_DEFAULT,
H5P_DEFAULT, H5P_DEFAULT );
}
}}}

Results in the following errors:

{{{
g++ -Wall -fexceptions -g -c Datagroup.cpp -o Datagroup.o
Datagroup.cpp:6: error: stray ‘@’ in program
Datagroup.cpp:6: error: stray ‘@’ in program
Datagroup.cpp:6: error: stray ‘@’ in program
Datagroup.cpp:6: error: stray ‘@’ in program
/usr/include/H5Gpublic.h: In function ‘hid_t DatagroupOpenOrCreate(hid_t,
const char*)’:
/usr/include/H5Gpublic.h:147: error: too many arguments to function ‘hid_t
H5Gcreate1(hid_t, const char*, size_t)’
Datagroup.cpp:10: error: at this point in file
}}}

I need to call H5Gcreate2, not H5Gcreate1. The macro H5_USE_16_API is
defined by including "hdf5.h", which is unexpected.

This is Ubuntu Linux libhdf5-serial-dev version 1.8.4-5.

Is there something I can do to explicitly get the 1.8 macro mappings? I'm
using a preexisting codebase and don't want to substitute H5Gcreate2() and
like functions everywhere.

Thanks.

Hi,

I am unable to compile on Ubuntu using the supplied HDF5 library. The
headers seem to insist on using version 1.6.

For example, the file:

{{{
#if defined( H5_USE_16_API )
    @@@@
#endif
#include <hdf5.h>
#if defined( H5_USE_16_API )
    @@@@
#endif

void DatagroupOpenOrCreate( hid_t parentID, const char * const groupPath ) {
    hid_t groupID = H5Gcreate( parentID, groupPath, H5P_DEFAULT,
H5P_DEFAULT, H5P_DEFAULT );
}
}}}

Results in the following errors:

{{{
g++ -Wall -fexceptions -g -c Datagroup.cpp -o Datagroup.o
Datagroup.cpp:6: error: stray ‘@’ in program
Datagroup.cpp:6: error: stray ‘@’ in program
Datagroup.cpp:6: error: stray ‘@’ in program
Datagroup.cpp:6: error: stray ‘@’ in program
/usr/include/H5Gpublic.h: In function ‘hid_t DatagroupOpenOrCreate(hid_t,
const char*)’:
/usr/include/H5Gpublic.h:147: error: too many arguments to function ‘hid_t
H5Gcreate1(hid_t, const char*, size_t)’
Datagroup.cpp:10: error: at this point in file
}}}

I need to call H5Gcreate2, not H5Gcreate1. The macro H5_USE_16_API is
defined by including "hdf5.h", which is unexpected.

You can either explicitely call H5Gcreate2() or define a macro
before including the HDF5 header file that controls which ver-
sion of the interface is used. With the following macros I
think everything is covered:

--------8<-----------------------------------
#define H5Acreate_vers 2
#define H5Adelete_vers 2
#define H5Aiterate_vers 2
#define H5Arename_vers 2
#define H5Dcreate_vers 2
#define H5Dopen_vers 2
#define H5Eclear_vers 2
#define H5Eprint_vers 2
#define H5Epush_vers 2
#define H5Eset_auto_vers 2
#define H5Eget_auto_vers 2
#define H5Ewalk_vers 2
#define H5Gcreate_vers 2
#define H5Gopen_vers 2
#define H5Pget_filter_vers 2
#define H5Pget_filter_by_id_vers 2
#define H5Pinsert_vers 2
#define H5Pregister_vers 2
#define H5Rget_obj_type_vers 2
#define H5Tarray_create_vers 2
#define H5Tcommit_vers 2
#define H5Tget_array_dims_vers 2
#define H5Topen_vers 2

#define H5_NO_DEPRECATED_SYMBOLS

#include <H5Cpp.h>
--------8<-----------------------------------

This is Ubuntu Linux libhdf5-serial-dev version 1.8.4-5.

I don't think there's anything special about Ubuntu, it's
that way everywere, see e.g.

http://www.hdfgroup.org/HDF5/doc/RM/APICompatMacros.html

                                Regards, Jens

···

On Wed, Jan 11, 2012 at 04:29:22PM -0700, Gordon Smith wrote:
--
  \ Jens Thoms Toerring ________ jt@toerring.de
   \_______________________________ http://toerring.de

Thank you for your reply. I was hoping to avoid the function mapping
macro definitions. It was good of you to gather them together.

My understanding is that most 1.8 libraries do not require any macro
definitions and the 1.8 backing functions are used by default. I had
overlooked the library mapping flag "--with-default-api-version=v16"
which is what must have been used in this case.

···

On Thu, Jan 12, 2012 at 7:47 AM, Jens Thoms Toerring <jt@toerring.de> wrote:

Hi,

On Wed, Jan 11, 2012 at 04:29:22PM -0700, Gordon Smith wrote:
> I am unable to compile on Ubuntu using the supplied HDF5 library. The
> headers seem to insist on using version 1.6.
>
> For example, the file:
>
> {{{
> #if defined( H5_USE_16_API )
> @@@@
> #endif
> #include <hdf5.h>
> #if defined( H5_USE_16_API )
> @@@@
> #endif
>
> void DatagroupOpenOrCreate( hid_t parentID, const char * const groupPath ) {
> hid_t groupID = H5Gcreate( parentID, groupPath, H5P_DEFAULT,
> H5P_DEFAULT, H5P_DEFAULT );
> }
> }}}
>
> Results in the following errors:
>
> {{{
> g++ -Wall -fexceptions -g -c Datagroup.cpp -o Datagroup.o
> Datagroup.cpp:6: error: stray ‘@’ in program
> Datagroup.cpp:6: error: stray ‘@’ in program
> Datagroup.cpp:6: error: stray ‘@’ in program
> Datagroup.cpp:6: error: stray ‘@’ in program
> /usr/include/H5Gpublic.h: In function ‘hid_t DatagroupOpenOrCreate(hid_t,
> const char*)’:
> /usr/include/H5Gpublic.h:147: error: too many arguments to function ‘hid_t
> H5Gcreate1(hid_t, const char*, size_t)’
> Datagroup.cpp:10: error: at this point in file
> }}}
>
> I need to call H5Gcreate2, not H5Gcreate1. The macro H5_USE_16_API is
> defined by including "hdf5.h", which is unexpected.

You can either explicitely call H5Gcreate2() or define a macro
before including the HDF5 header file that controls which ver-
sion of the interface is used. With the following macros I
think everything is covered:

--------8<-----------------------------------
#define H5Acreate_vers 2
#define H5Adelete_vers 2
#define H5Aiterate_vers 2
#define H5Arename_vers 2
#define H5Dcreate_vers 2
#define H5Dopen_vers 2
#define H5Eclear_vers 2
#define H5Eprint_vers 2
#define H5Epush_vers 2
#define H5Eset_auto_vers 2
#define H5Eget_auto_vers 2
#define H5Ewalk_vers 2
#define H5Gcreate_vers 2
#define H5Gopen_vers 2
#define H5Pget_filter_vers 2
#define H5Pget_filter_by_id_vers 2
#define H5Pinsert_vers 2
#define H5Pregister_vers 2
#define H5Rget_obj_type_vers 2
#define H5Tarray_create_vers 2
#define H5Tcommit_vers 2
#define H5Tget_array_dims_vers 2
#define H5Topen_vers 2

#define H5_NO_DEPRECATED_SYMBOLS

#include <H5Cpp.h>
--------8<-----------------------------------

> This is Ubuntu Linux libhdf5-serial-dev version 1.8.4-5.

I don't think there's anything special about Ubuntu, it's
that way everywere, see e.g.

http://www.hdfgroup.org/HDF5/doc/RM/APICompatMacros.html

                           Regards, Jens

--
\ Jens Thoms Toerring ________ jt@toerring.de
\_______________________________ http://toerring.de

Hi Gordon,

Thank you for your reply. I was hoping to avoid the function mapping
macro definitions. It was good of you to gather them together.

My understanding is that most 1.8 libraries do not require any macro
definitions and the 1.8 backing functions are used by default. I had
overlooked the library mapping flag "--with-default-api-version=v16"
which is what must have been used in this case.

Did you install HDF5 from the Ubuntu package manager? That version of
HDF5 is maintained by a third party and is wildly out of date. It is
much better to build HDF5 from source.

Cheers,

Dana Robinson