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

how to set entry point

cvnravi
Beginner
544 Views
Hi,

I havewindows application in VC++ 4.0, I ported window to console basedapplication which has both c++ and fortran code. It is comiling good, while running it is calling fortran main instead of c++. I want to run the applicationby calling c++ main. how to set entry point to c++ main instead of fortran main(PROGRAM).


Thanks in advance,
ravi




Thanks in advance,
0 Kudos
3 Replies
TimP
Honored Contributor III
544 Views
Normally, you would not use a Fortran main as well as a C++ main. Your C++ would call a Fortran procedure set up with iso_c_binding (although that came years later than your C++) or equivalent Windows-specific interfacing.
0 Kudos
cvnravi
Beginner
544 Views
Quoting - tim18
Normally, you would not use a Fortran main as well as a C++ main. Your C++ would call a Fortran procedure set up with iso_c_binding (although that came years later than your C++) or equivalent Windows-specific interfacing.

Hi tim,

actually the code is in 'C' language and i just renamed the file names to .cpp. Is there any settings option that I need to set as iso_c_binding to run as c main? Because when i am running the ported application its is starting from fortran code called (PROGRAM abc). Anyway I am using the same old comiler VC++ 4.0 with supported fortran compiler.

0 Kudos
TimP
Honored Contributor III
544 Views
If you don't have a recent Fortran, you won't be able to use iso_c_binding. Assuming that your Fortran defaults to upper case link symbols without appending underscores (typical possible defaults), you call from C like
..C code..
YOURFORTRAN(arglist);
....
Fortran code:
SUBROUTINE YOURFORTRAN(arglist)
...

but you would want to go back to .C files so that YOURFORTRAN doesn't have C++ mangling applied.
Utilities like dumpbin will help you see if you got the naming consistent in the .obj.
Popular Windows Fortran compilers back then were extremely buggy, so don't waste too much time before adopting a recent alternative.
0 Kudos
Reply