Our application predates Fortran 90. For speed reasons (mostly) we developed a method of storing the data for the app in binary files using Windows C primatives (e.g. _read, _write). While we might not do this today (probably not), it works very well. We'd like to extend this methodology to handle Fortran derived types. It seems, offhand, that to do so I would need to know the storage length of type in bytes, and be able to be certain that the components are always arranged the same way in storage. Can someone help with these questions or suggest an alternative (other than the obvious one, read/write each component)?
If the derived type is declared with the BIND(C) attribute, you can be reasonably confident it isn't going to get rearranged, not that I know of ANY Fortran compilers that rearrange types. You may or may not get padding in different compilers - BIND(C) will ensure that the layout matches what the "companion C processor" would do.
As for length, that's what STORAGE_SIZE is for.