Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Calling a C++ function from F90

albert_k_
Beginner
262 Views

 

 

 

#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
Steve_Lionel
Honored Contributor III
262 Views

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?

0 Kudos
FortranFan
Honored Contributor II
262 Views

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
Reply