- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The questions are:
1) I built a mixed program Project into Visual Studio c++ 6.0. In order to link the all project (a main cpp, object cpp, subroutin f77) I didn't use ___stdcall for calling fortran subroutine and I remove /Gz from options of Fortran compiler. Otherwise I Keep /Gz in fortran compiler 's options, everything is ok. But if I write:
extern "C" void __stdcall CMPROOT(fdcomplexnum* num);
I got the error message
error LNK2001: unresolved external symbol _CMPROOT@4
SO which is the right procedure, choice of options to keep __stdcall in the code? {this is for compatibility with other compilers)
2) When I used Compact Visual Fortran 5 I had color utilities to recognize fortran code. How can I get it in Visual c++ 6.0 while I am using Intel Fortran compiler?
thank you Guido Lombardi
1) I built a mixed program Project into Visual Studio c++ 6.0. In order to link the all project (a main cpp, object cpp, subroutin f77) I didn't use ___stdcall for calling fortran subroutine and I remove /Gz from options of Fortran compiler. Otherwise I Keep /Gz in fortran compiler 's options, everything is ok. But if I write:
extern "C" void __stdcall CMPROOT(fdcomplexnum* num);
I got the error message
error LNK2001: unresolved external symbol _CMPROOT@4
SO which is the right procedure, choice of options to keep __stdcall in the code? {this is for compatibility with other compilers)
2) When I used Compact Visual Fortran 5 I had color utilities to recognize fortran code. How can I get it in Visual c++ 6.0 while I am using Intel Fortran compiler?
thank you Guido Lombardi
Link Copied
7 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Intel Fortran does not use STDCALL as the default calling mechanism. I think you want to take out the __stdcall and not use /Gz. (If I am understanding you properly.)
You cannot get Fortran source coloring in the VC6 environment with Intel Fortran. You will get it in the VC.NET environment with Intel Fortran 7.x.
Steve
You cannot get Fortran source coloring in the VC6 environment with Intel Fortran. You will get it in the VC.NET environment with Intel Fortran 7.x.
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you,
so the right way to mix code is removing the __stdcall from c header (that I need to call the frotran routine from C) and removing /Gz from the fortran compiler, is it?
Guido Lombardi
so the right way to mix code is removing the __stdcall from c header (that I need to call the frotran routine from C) and removing /Gz from the fortran compiler, is it?
Guido Lombardi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If I correctly understand what you have, yes.
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A side note: a nicer way is to have
#define FORTRAN_CALL __cdecl ... extern "C" void FORTRAN_CALL FortranRoutine(...Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is not the first time the wording of the documentation has created confusion. /Gm is the version of __stdcall which works with Fortran 77 in general, as well as matching the default usage of CVF, but you wouldn't know it from the documentation. /Gz doesn't support CHARACTER arguments in a workable way. jugoslavdujic makes a good suggestion, which will work with Windows-ia64 as well, where Microsoft doesn't support __stdcall.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am getting confused:
My working solution is:
first solution:
1) without /Gz, /Gm
2) extern "C" void FortranRoutine(...);
or
extern "C" void __cdecl FortranRoutine(...);
first solution:
1) without /Gz, with /Gm
2) extern "C" void __stdcall FortranRoutine(...);
What is the right way to mix code in vc++ 6 with c++ code (main, routine) and fortran (routine)?
thank you,
Guido
My working solution is:
first solution:
1) without /Gz, /Gm
2) extern "C" void FortranRoutine(...);
or
extern "C" void __cdecl FortranRoutine(...);
first solution:
1) without /Gz, with /Gm
2) extern "C" void __stdcall FortranRoutine(...);
What is the right way to mix code in vc++ 6 with c++ code (main, routine) and fortran (routine)?
thank you,
Guido
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Both are correct. I only suggested introducing a #define in C++ code so that you can change it in one place if/when you change the Fortran compiler/compiler option/OS and make code more readable -- an aesthetical rather than essential remark. Tim just commented that the documentation was less than ideal on the /Gm-/Gz subject.
Jugoslav
Jugoslav

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page