Note that there are some explanatory texts on larger screens.

plurals
  1. POinteroperability between Cpython and fortran linked lists
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. COI'm not sure that the implementation of fortran pointers is standardized between compilers -- So I'm doubtful that you'll be able to do this. If you only need 1 linked list, you could put one in a module and have a bunch of functions use that module to access it -- That's pretty hacky of course. Also note that python pretty much makes the necessity for a linked-list a non-issue ... You can always convert a python list to a numpy array and pass that around (but I understand that working with legacy code might make that difficult)...
      singulars
    2. COThat won't be C interoparable as it is. You could use `type(cptr)` as pointer to point to the next structure, but then you would have to convert inside Fortran this pointer via `c_f_pointer()` to be useable (and with `f_c_pointer()` back if needed), so rather a pain...
      singulars
    3. COBy far the easiest would probably be to create an array based on the linked list and pass that to python. But that would be a quite heavy operation. Directly accessing your existing list from C is possible, but not in a portable way (You would need to reverse engineer how the fortran pointer is represented, and how the derived type is laid out in memory. And then hope it doesn't change in the next compiler release).
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload