Hi,
I am calling fortran library(ARPACK, a sparse matrix library) from c++. Does anyone know how to link the C++ code with the fortran libary? Is there some options in pgcpp I need specify?
Thank you!!!
Yonggang
Hi,
I am calling fortran library(ARPACK, a sparse matrix library) from c++. Does anyone know how to link the C++ code with the fortran libary? Is there some options in pgcpp I need specify?
Thank you!!!
Yonggang
Hi Yonggang,
Chapter 11 of the PGI User’s Guide (See: http://www.pgroup.com/doc/pgiug.pdf) details inter-language calling, including C++ calling Fortran.
Basically, you need to an underscore (“_”) to the end of the Fortran function name in your C++ code and pass all your variables by reference. You also need to match your data types correctly depending upon if your compiling in 32 or 64-bits.
Hope this helps,
Mat