Fortran libraries to work with parquet files

That is exactly what I was looking for. brilliant! I had been playing around randomly with initialising things with c_null_ptr, in previous attempts. Would be great if anyone had an explanation for it.

Indeed it runs and it seems to do what it needs to do. After creating the schema I’m now converting the schema to string with garrow_schema_to_string() and it does print what it it is supposed to print.

Thanks for the tip @vmagnin !

1 Like

Sorry for the initial g_list_alloc() false track…

In the 1999 PDF I cited yesterday, they say:

In the glib implementation, the empty list is simply a NULL pointer. It’s always safe
to pass NULL to list functions since it’s a valid list of length 0. Code to create a list
and add one element might look like this:
GSList* list = NULL;
gchar* element = g_strdup(“a string”);
list = g_slist_append(list, element);
glib lists have a noticeable Lisp influence; the empty list is a special “nil” value for that
reason.

And the Wikiversity site says:

As you may have noticed, NULL is enough to fill a pointer to an empty GList. Indeed, the g_list_append function will initialize this pointer when adding the first element.
glist_append returns a pointer to the new starting address of the list, because this one can change. Its first parameter is a pointer to the list. Its second parameter is a pointer to the data to add. If list is NULL, creation of a new GList.
Translated with DeepL Translate: The world's most accurate translator (free version)

:sweat_smile: never mind! I should have read it rather than skimming through it! But makes sense after reading that and it’s reassuring that it is how it’s supposed to work rather than some nuances of the fortran/c interperability.

With that trick I’ve managed to also work through the next section of the getting started example. So as a next step I’ll check the other data structure (chunked arrays and tables) and then move on to the I/O.

1 Like

A good tutorial about GList and other data structures of the GLib:
https://developer.ibm.com/tutorials/l-glib/