Re: Calling a fortran subroutine from Visual C++
- From: "Norman Diamond" <ndiamond@xxxxxxxxxxxxxxxx>
- Date: Fri, 17 Jun 2005 11:52:55 +0900
"William DePalo [MVP VC++]" <willd.no.spam@xxxxxxxx> wrote in message news:uo37xpscFHA.3620@xxxxxxxxxxxxxxxxxxxxxxx
"Ray J." <Ray J.@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:51F7C3A6-1708-40F7-ABB6-F96CBC142300@xxxxxxxxxxxxxxxx
I have a C++ program written and compiled on Solaris 8 with gcc. With gcc lets me compile fortran code along with the C++ program to be able to call the fortran code as a subroutine.
I never noticed that, but maybe it's not surprising since the Gnu Fortran compiler is closely related to gcc. Depending on your needs, have you tried Windows Services for Unix? I've used gcc (though not Gnu Fortran) in that environment.
Is there a way to call fortran code from a C++ program compiled with Visual C++?
Old MSDN libraries used to say how! Microsoft used to make a Fortran compiler, they sold the product and it became the DEC Fortran compiler for Windows, which became the Compaq Fortran compiler for Windows, and then Compaq or HP sold the product and now it's the Intel Fortran compiler for Windows. But MSDN libraries no longer say how to interoperate with it, so you'll need Intel's documents.
It's not clear to me what tools you have. [...] if it allows you to build a DLL, then the expedient thing to do is export your function from the DLL [...]
The big questions are what the types are, and whether there are arrays and stuff like that. By the way the declarations in the C++ program will surely need to be wrapped in extern "C" {}.
You will find some free Fortran compilers here: http://www.thefreecountry.com/compilers/fortran.shtml
Interesting page, thank you. Hmm, they say that Intel's compiler is free for personal non-commercial use. I don't think it was when I hunted it down a while back.
They also list f2c, which I've used before. The resulting C code isn't human readable but it does compile, and can be called from C++ callers.
.
- References:
- Calling a fortran subroutine from Visual C++
- From: Ray J.
- Re: Calling a fortran subroutine from Visual C++
- From: William DePalo [MVP VC++]
- Calling a fortran subroutine from Visual C++
- Prev by Date: Pinning Pointers with __pin in Managed C++
- Next by Date: STDIN and STDOUT in C
- Previous by thread: Re: Calling a fortran subroutine from Visual C++
- Next by thread: How to get rid of scrollbars in datagrid?
- Index(es):
Relevant Pages
|