Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Command line arguments in C main()

sebastian_gurgul
Beginner
578 Views
Hello,

I am working on software containing both Fortran & C parts.
My main() function is written in C (compiled with GCC 3.2.3) but the biggest part of the sources are prepared for IFC (9.0).

To compile and link the package I had to modify standard C signature for main() function:

Standard:
int main(int argc, char ** argv)

Modified version:
void MAIN__()

After the modification I am not able to get and process command line arguments (argc & argv). Even if I modify MAIN__ signature to handle them:
void MAIN__(int argc, char ** argv)
both variables (arg*) contain trashes.

Is there any way to handle command line arguments from C code linked with object files compiled with IFC ?

I tried to do the same with G95 and it seems to work :(
0 Kudos
2 Replies
Steven_L_Intel1
Employee
578 Views
Don't change the C main. Do build the Fortran code with -nofor_main.
0 Kudos
sebastian_gurgul
Beginner
578 Views
Thank you,

Sebastian
0 Kudos
Reply