Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
7 Views

Calling a C++ function from F90

 

 

 

#include "../lib/probeLocations.H"


int main(int argc, char *argv[])
{
    probeLocations(argc, argv);

    return 0;
}

I need to call the C++ function  probeLocations from f90 main code. How do I pass argc and argv from F90?

0 Kudos
2 Replies
Black Belt Retired Employee
7 Views

You don't - those are

You don't - those are strictly C/C++ notions, though it might be possible to construct equivalents with some effort.

The Fortran language provides extensive C interoperability features, extended in Fortran 2015 - Intel Fortran supports those. Note that I said C and not C++; you can use C++ as long as you restrict that side to what looks like C (extern "C", etc.)

There's no point in talking about "F90". Say "Fortran" instead.

What does this probeLocations do? You may be able to accomplish this from Fortran directly. Does it actually use argc and argv?

--
Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos
Highlighted
Valued Contributor III
7 Views

Quote:albert k. wrote:

albert k. wrote:

.. How do I pass argc and argv from F90? ..

I concur, please just refer to Fortran.

Also, you can look into Fortran standard intrinsic functions of GET_COMMAND_ARGUMENT and COMMAND_ARGUMENT_COUNT

0 Kudos