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

argc and argv not reset?

STVW
Beginner
1,133 Views

Hi, I am working on a project which for historical reasons has a lot of Fortran code. What I was doing was basically calling these subroutines from C++, I'm working on a Linux machine with 2019.

Because of the way the Fortran code was written, I had no choice but to do the following job:

for (int i = 0; i < N; ++i) {

   int argc = update_argc_from_c(i);
   char** argv = update_argv_from_c(i);

   for_rtl_init_(&argc, argv);

   // call Fortran subroutines and functions, where
   // iargc(), getarg() were used

   for_rtl_finish_();
}

My problem was, I don't think the internal argc and argv variables got updated, at least not for argv, starting from the second loop...

(Yes, I checked the values in for__a_argv)

Any suggestions?

Thanks.

0 Kudos
0 Replies
Reply