How to interact with fortran code

Chris via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 9 08:09:07 PDT 2014


On Wednesday, 9 July 2014 at 15:00:25 UTC, seany wrote:
> I apologize many times for this question, may be this had 
> already been answered somewhere, but considering today the last 
> of my nerve is broken, I can not really find the soution.
>
> So I have a D code, which acts as a central manager of all my 
> codes, reads user input, reads files, etc, and based on the 
> file readouts, I would like to pass some variables from the D 
> code to a fortran code, in binary format, perhaps, if such a 
> thing exists, instead of encoding to text/ ASCII first.
>
> I would also like to read some (not all) variables back from 
> the fortran code.
>
> The Fortran code resides in a subdirectory to the path/to/d/code
>
> How to do this? is there a preffered way / easier than system 
> call way to interface D and Fortran code? This must be Fortan 
> code - these are the standard atmospheric chemistry codes.
>
> I apologize again if the question is stupid, trust me, today 
> all my nerves are broken.

Off the top of my head I'd say you could try to interface Fortran 
and C. Then you could interface D and C, i.e. D > C > Fortran.

http://fortranwiki.org/fortran/show/Generating+C+Interfaces
https://gcc.gnu.org/onlinedocs/gcc-3.4.4/g77/C-Interfacing-Tools.html


More information about the Digitalmars-d-learn mailing list