Endianness doesn't seem to be conserved in FORTRAN shared libraries?

So, it turns out that for gfortran shared libraries the endianness is specified at runtime, rather than at compile time. Therefore, all that needs to be done is:

ENV["GFORTRAN_CONVERT_UNIT"] = "big_endian"

before ccall and then it works correctly.

Reference here.

Thanks!

2 Likes