My biggest problem with ISO_Fortran_binding.h and assumed shape arrays is that it forces me to write more C code than I need. To me that defeats the purpose of the original idea behind the Fortran C-Interop facility. Basically, if you know the C function prototype you can call a C function without writing any additional C code. Conversely, on the C side all you have to do is write a conforming function prototype for the Fortran routine and call it without resorting to convoluted name mangling. However, I’ll admit that 99.99% of my forays into C-Interop has been Fortran calling C so I rarely see a need for writing another C wrapper around my target C routine just so I can use assumed shape arrays.
Related topics
Topic | Replies | Views | Activity | |
---|---|---|---|---|
Iso_c_binding: pass an array from c to fortran (Edit: python interop content)
|
25 | 3744 | June 14, 2024 | |
bind(C) philosophy: pointer-by-value or type-by-reference? | 12 | 1042 | July 3, 2022 | |
Why can't FORTRAN determine the size of a given C array?
|
19 | 1293 | July 10, 2023 | |
Question about assumed type arrays and C_NULL_PTR | 20 | 954 | August 11, 2023 | |
Return an array of strings from fortran to c++ | 14 | 1803 | February 3, 2023 |