>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
[quoted text clipped - 3 lines]
> call
> fortran code from a C++ program compiled with Visual C++?
>> 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.