How do you correctly align array memory when using unsafe_store! to write a struct array to a c or fortran program?

I suspect the len parameter in fortran causes the string to be allocated inline - this is not the case of the general String type in julia, which is internally stored as a pointer due to the dynamic length of a string. Depending on what exactly that character(256) is, you’re probably looking for something like NTuple{256, UInt8} (or another element type).

1 Like