[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++ interface to netCDF



> From: Tom LeFebvre <address@hidden>
> To: Russ Rew <address@hidden>
> Subject: C++ interface to netCDF

Hi Tom,

> Greetings!  It's been a while since I've contacted you.  We recently
> upgraded our systems here and I was most pleased to see that you have
> an offical release of the C++ interface to netCDF.  I've browsed your
> web pages and I was very impressed.  Congratulations on a fine job.

Thanks.

> Recently, we bumped into a strange problem using netCDF and I'd like
> your comment.  Last month we upgraded to HPUX 10.20, new C++ complier,
> and a the latest version of netCDF, so it's very unclear where the
> problem lies.
> 
> Our upgrade went just fine, until we attempted to PURIFY our database
> software.  The code works perfectly when not running Purify.  But when
> using Purify, we get a segmentation fault when we call the NcFile
> constructor, with the FileMode argument set to NcFile::Write AND the
> file already exists.  Here's the code...
> 
> 
>   _databaseId = new NcFile(filename.stringPtr(), NcFile::Write);
> 
> 
> When this is executed, and the file exists, we get a segmentation
> fault while using Purify.  Without Purify, the code works fine.
> 
> Since I know that you guys use Purify too, I was wondering if you have
> ever run across this problem.  It is rather silly, since in real time
> we never use the Purified version.  But we can't Purify our code,
> since we can't get past this statement.  Any light you can shed will be
> most appreciated.  Thanks!

We've never run across it, but we also haven't been doing much with the
C++ interface lately.  (I'm concentrating more on the Java interface
right now, since I'd like to have a deliverable Java release some time
this month.)

I just tried to duplicate the error here with a small test program
containing an invocation of the constructor in your example, and it
worked fine on Solaris 5.5 with Purify 4.0.1.  Then I tried it on an
HPUX 9.05 system, again with Purify 4.0.1, and it worked fine.

We don't yet have access to an HPUX 10 platform, so I can't try it
there.  But the above would seem to point to a bug in the HPUX
10.20/Purify combination.

Here's the test program I tried, with an existing "example.nc" file:

#include <iostream.h>
#include <string.h>
#include "netcdf.hh"

int
main( void )    // test new netCDF interface
{
    const char* path = "example.nc";
    NcFile* ncp = new NcFile(path, NcFile::Write);

    // Check if the file was opened successfully
    if (! ncp->is_valid()) {
        cerr << "can't create netCDF file " << path << "\n";
        return 1;
    }

    cerr << path << " opened OK" << "\n";
    
    return 0;
}

--Russ

_____________________________________________________________________

Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu