Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!

Calling a C++ function from F90

albert_k_
Beginner
89 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
Black Belt Retired Employee
89 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?

FortranFan
Honored Contributor II
89 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

Reply