Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29594 ディスカッション

Calling a Fortran routine from a C++ program.

rthimmana
ビギナー
1,933件の閲覧回数
Hi..
I am calling a Fortran routing in a fortran file named TRIANGLE.F
the code i used to call the fortran routine is as follows
#include
#include
extern "C"
{
void __stdcall TRIANGLE();
}
void main()
{
TRIANGLE();
}
I am not sure whether this code would be sufficient..i created a dll of the fortran file and added it to the project..also i added the dfor.lib to the link in the project/settings.
The errors that i am getting are run time errors and not any compile time errors. They are..
Linking...
cfort.obj : error LNK2001: unresolved external symbol _TRIANGLE@0
Debug/attempt5.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
could someone help me and explain me or provide me with links where i can learn to fix the problems..
Thanks in advance..
Raghavendher Thimmana
0 件の賞賛
3 返答(返信)
Steven_L_Intel1
従業員
1,933件の閲覧回数
You need to add the .lib created when you built the DLL, not the DLL itself. The DLL is not used in the linking process.
rthimmana1
ビギナー
1,933件の閲覧回数
thanks steve.
well i was able to successfully call the fortran program from a C++ in the Visual Studio interface. Asu said i had to add the .obj file to the project.
I have another question..
I was able to run the program with Visual Studio 6.0 and Fortran 95(Compaq Visual Fortran)
However i need to implement the same on another system with Visual Studio.Net and Fortran 77.
the program is compiling but a runtime error pops up saying that dforrt.dll was not found. I was trying to find a copy of the dll online..but is the dll available only with the Fortran 95 version..?? how can i get the dll. do i need to install the fortran 95 on the system i have to implement the program..??
Thanks in advance..
raghavendher thimmana
Steven_L_Intel1
従業員
1,933件の閲覧回数
Go to http://www.compaq.com/fortran/visual/redist.html Download the package there and install it on the other machine.
返信