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

[netCDF #YZD-296984]: Read a vlen array in Fortran

This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.


  • Subject: [netCDF #YZD-296984]: Read a vlen array in Fortran
  • Date: Fri, 07 Jul 2017 12:12:24 -0600

What is odd about the vlen valgrinds is that they do
not appear to show an illegal overwrite of memory.

Turning to the string code, it is clear that the string code
is not calling nc_inq_type with the correct parameters.
I can use gdb and see what is passed in to the underlying
nc_inq_type. The incoming arguments look ok to me. So,
somehow the arguments at the fortran level are not correct.

I am guessing that properly defining and passing
a string as a char* from fortran to c is more complicated
that I know how to do. I have attached a simplified version
that does not use nf_inq_type and uses nf_put_att instead
of nf_put_var. It also assumes that sizeof(char*) is 4.
See comments in the code.
Until we can figure out the proper way to pass a string,
I am stuck.
 
=Dennis Heimbigner
  Unidata


Ticket Details
===================
Ticket ID: YZD-296984
Department: Support netCDF
Priority: Normal
Status: Open
===================
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata 
inquiry tracking system and then made publicly available through the web.  If 
you do not want to have your interactions made available in this way, you must 
let us know in each email you send to us.

Attachment: string.f90
Description: Binary data