On 6 May 2011 16:45, Tim Hutt <tdh...@gmail.com> wrote: > On 6 May 2011 16:27, Tim Prince <tcpri...@live.com> wrote: >> If you want to use the MPI Fortran library, don't convert your Fortran to C. >> It's difficult to understand why you would consider f2c a "simplest way," >> but at least it should allow you to use ordinary C MPI function calls. > > Sorry, maybe I wasn't clear. Just to clarify, all of *my* code is > written in C++ (because I don't actually know Fortran), but I want to > use some function from PARPACK which is written in Fortran.
Hmm I converted my C++ code to use the C OpenMPI interface instead, and now I get link errors (undefined references). I remembered I've been linking with -lmpi -lmpi_f77, so maybe I need to also link with -lmpi_cxx or -lmpi++ ... what exactly do each of these libraries contain? Also I have run into the problem that the communicators are of type "MPI_Comm" in C, and "integer" in Fortran... I am using MPI_COMM_WORLD in each case so I assume that will end up referring to the same thing... but maybe you really can't mix Fortran and C. Expert opinion would be very very welcome! Tim