- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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
링크가 복사됨
7 응답
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
A side note: a nicer way is to have
#define FORTRAN_CALL __cdecl ... extern "C" void FORTRAN_CALL FortranRoutine(...Jugoslav
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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.
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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