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.
The nf_put_vlen_element function is basically a wrapper around a C function with this signature: int nc_put_vlen_element(int ncid, int typeid1, nc_vlen_t *vlen_element, /*ptr to the nc_vlen_t object to build */ size_t len, /* value for nc_vlen_t.len */ const void *data /* value for nc_vlen_t.p */ ) This means that vlen and vlen_in must be a byte array of size sizeof(nc_vlen_t). Since you are passing a pointer to an integer and sizeof(integer) < sizeof(nc_vlen_t), I would expect that you are doing a bad memory write. This may not show up immediately. I would expect that if you ran your program with valgrind (or some other memory leak detector) that it would complain about writing in unallocated memory. I would do this, but valgrind is linux only and I am running cygwin/Windows. If you are on a linux machine and can install valgrind, you might try this command: valgrind --leak-check=full f90tst_vars_vlen.exe BTW this code test only writes a single nc_vlen_t instance. If you have an array of vlen, you need to be more precise about your memory allocation. Also re: nf_inq_typeids was 0. At the point you called this, either you had the wrong group id (ncid) or that group did not contain any user-defined types. Remember that String is a primitive type, not a user-defined type. =Dennis Heimbigner Unidata Ticket Details =================== Ticket ID: YZD-296984 Department: Support netCDF Priority: Normal Status: Closed =================== 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.