extern void __stdcall FORTRANFUNCTION(const double *array1, const double *scalar1 [, etc.]); // Since FORTRAN typically expects arguments by reference, arguments are passed // as pointers. To pass values, the FORTRAN code must contain a compiler directive // telling the function to expect a value rather than an address. LRESULT mcadfunction(LPCOMPLEXARRAY array1, LPCCOMPLEXSCALAR scalar1, etc.) // this defines the function before FUNCTIONINFO, using the same variable names // called by the external FORTRAN function. { // some error checking goes here, followed by the // actual call to the FORTRAN function. For example, FORTRANFUNCTION(&array1->hReal[0][0], &scalar1->real [, etc.]); // Either the function call must be in UPPERCASE, or you will have to set // Settings->FORTRAN->External procedures->External name implementation // to "Upper case" in your FORTRAN compiler. Any other C functionality follows... return 0; }
連結程式庫
1. 在 MS Visual C++ 或 Visual Studio 現有的 C 專案中,選取「連結器」標籤,然後從「種類」功能表中選取「輸入」。在清單結尾的 Object/library modules 文字方塊中輸入 [myfortranlib].lib。
SUBROUTINE INIT_STDOUT () c this subro which redirects FORTRAN output to file use dfwin integer res c CALL close_stdout res=SETENVQQ("FOR_PRINT=C:\FORT_OUT.TXT") c PRINT *, 'Print a character to initialize ' PRINT *,' ' RETURN END