From 5a4bf8171df9473047d1eda534ed9a6a4d0749d9 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Thu, 8 Mar 2007 04:50:55 -0500 Subject: [svn-r13474] Purpose: Fixed bugs Description: VMS revealed a problem in calling C++ test functions from C AddTest. Solution: Per Quincey's suggestion, added #ifdef __cplusplus extern "C" #endif to the called C++ functions. Platforms tested AIX 5.1 (copper) Linux 2.6 (kagiso) On pending: waiting for Elena to test on VMS when she comes back. --- c++/test/h5cpputil.h | 8 ++++++++ c++/test/tattr.cpp | 6 ++++-- c++/test/tcompound.cpp | 5 ++++- c++/test/tfile.cpp | 6 ++++-- c++/test/tfilter.cpp | 3 +++ c++/test/th5s.cpp | 6 ++++-- c++/test/trefer.cpp | 6 ++++-- c++/test/ttypes.cpp | 3 +++ c++/test/tvlstr.cpp | 3 +++ 9 files changed, 37 insertions(+), 9 deletions(-) diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h index 3c7efe1..bb08f45 100644 --- a/c++/test/h5cpputil.h +++ b/c++/test/h5cpputil.h @@ -95,6 +95,9 @@ class InvalidActionException : public Exception { }; /* Prototypes for the test routines */ +#ifdef __cplusplus +extern "C" { +#endif void test_attr(void); void test_compound(void); void test_file(void); @@ -113,6 +116,11 @@ void cleanup_h5s(void); void cleanup_reference(void); void cleanup_types(void); void cleanup_vlstrings(void); + +#ifdef __cplusplus +} +#endif + /* not yet void cleanup_select(void); void cleanup_time(void); diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index a6fd8de..ede7e31 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -1200,8 +1200,10 @@ test_string_attr(void) ** test_attr(): Main attribute testing routine. ** ****************************************************************/ -void -test_attr(void) +#ifdef __cplusplus +extern "C" +#endif +void test_attr(void) { // Output message about test being performed MESSAGE(5, ("Testing Attributes\n")); diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp index 54344a8..f6571b1 100644 --- a/c++/test/tcompound.cpp +++ b/c++/test/tcompound.cpp @@ -596,7 +596,7 @@ static void test_compound_6(void) buf = (unsigned char*)malloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); bkg = (unsigned char*)malloc(nelmts * sizeof(dst_typ_t)); orig = (unsigned char*)malloc(nelmts * sizeof(src_typ_t)); - for (int i=0; ib = (i*8+1) & 0x7fff; s_ptr->d = (i*8+6) & 0x7fff; @@ -731,6 +731,9 @@ static void test_compound_7(void) * *------------------------------------------------------------------------- */ +#ifdef __cplusplus +extern "C" +#endif void test_compound(void) { // Output message about test being performed diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index 13ed377..f3d9574 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -492,8 +492,10 @@ test_file_name() * *------------------------------------------------------------------------- */ -void -test_file(void) +#ifdef __cplusplus +extern "C" +#endif +void test_file(void) { // Output message about test being performed MESSAGE(5, ("Testing File I/O operations\n")); diff --git a/c++/test/tfilter.cpp b/c++/test/tfilter.cpp index dd17d74..2a9503a 100644 --- a/c++/test/tfilter.cpp +++ b/c++/test/tfilter.cpp @@ -248,6 +248,9 @@ void test_szip_filter(H5File& file1) ** ****************************************************************/ const H5std_string FILE1("tfilters.h5"); +#ifdef __cplusplus +extern "C" +#endif void test_filters(void) { // Output message about test being performed diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index 8ae34a6..9c49105 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -591,8 +591,10 @@ test_h5s_compound_scalar_read(void) * Modifications: *------------------------------------------------------------------------- */ -void -test_h5s(void) +#ifdef __cplusplus +extern "C" +#endif +void test_h5s(void) { // Output message about test being performed MESSAGE(5, ("Testing Dataspaces\n")); diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index 155f122..edcd968 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -277,8 +277,10 @@ test_reference_obj(void) ** test_reference(): Main reference testing routine. ** ****************************************************************/ -void -test_reference(void) +#ifdef __cplusplus +extern "C" +#endif +void test_reference(void) { // Output message about test being performed MESSAGE(5, ("Testing References\n")); diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index 299c4e4..4e9faae 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -774,6 +774,9 @@ cerr << "all the way here?" << endl; ** test_types(): Main data types testing routine. ** ****************************************************************/ +#ifdef __cplusplus +extern "C" +#endif void test_types(void) { // Output message about test being performed diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp index c8a05c5..b1815a3 100644 --- a/c++/test/tvlstr.cpp +++ b/c++/test/tvlstr.cpp @@ -758,6 +758,9 @@ static void test_vl_rewrite(void) ** test_vlstrings(): Main VL string testing routine. ** ****************************************************************/ +#ifdef __cplusplus +extern "C" +#endif void test_vlstrings(void) { // Output message about test being performed -- cgit v0.12