c调用fortran子程序 [英] c calling a fortran subroutine
问题描述
我正在开发Visual Studio .NET 2003中的ac程序。我还有一个
用于MVS .NET的英特尔(R)Fortran编译器
我的fortran源码已经存在。我开始了一个新的fortran项目,并且
选择创建一个动态链接库。 fortran代码的开头
看起来像:
SUBROUTINE SFTCK3
!DEC $ ATTRIBUTES DLLEXPORT :: SFTCK3 >
它编译好了,并创建了一个SFTCK3.lib和SFTCK3.dll
在C代码中,我尝试了各种在线建议,但现在它
看起来像:
(来自顶部)
#include< stdio.h>
#include< process.h>
#include< iostream.h>
#include" SelectOp.h"
#include" SelectOpGui.h"
extern void _stdcall SFTCK3(void);
稍后,在代号,我打电话给:
案例8:
SFTCK3();
休息;
尝试构建时出现以下错误:
错误LNK2019:未解析的外部符号_SFTCK3 @ 0在函数中引用
_SelectOp_OnOperation,这将是上面的调用。
在c中代码''属性设置,我确实有,在其他依赖项下:
c:\ Temp \FAST_CSCI \SFTCK3 \SFTCK3.lib
我很确定这是因为我没有将c和fortran连在一起,但
不知道如何让这个工作。任何帮助,将不胜感激。谢谢
I am developing a c program in Visual Studio .NET 2003. I also have an
Intel(R) Fortran compiler for MVS .NET
My fortran sourcecode already existed. I started a new fortran project and
chose to create a dynamic link library. The beginning of the fortran code
looks like:
SUBROUTINE SFTCK3
!DEC$ ATTRIBUTES DLLEXPORT::SFTCK3
It compiled ok, and created both a SFTCK3.lib and SFTCK3.dll
In the C code, I''ve tried a variety of online suggestions, but for now it
looks like:
(from top)
#include <stdio.h>
#include <process.h>
#include <iostream.h>
#include "SelectOp.h"
#include "SelectOpGui.h"
extern void _stdcall SFTCK3 (void);
later on, in the code, i call:
case 8:
SFTCK3();
break;
I get the following error when trying to build:
error LNK2019: unresolved external symbol _SFTCK3@0 referenced in function
_SelectOp_OnOperation, which would be the call made above.
In the c codes'' property settings, i do have, under additional dependencies:
c:\Temp\FAST_CSCI\SFTCK3\SFTCK3.lib
I''m pretty sure it''s because I''m not linking the c and fortran together, but
not sure how to get this working. Any help would be appreciated. Thanks
推荐答案
属性DLLEXPORT :: SFTCK3
它编译好了,并创建了一个SFTCK3.lib和SFTCK3.dll
在C代码中,我尝试过各种各样的在线建议,但现在它已经看起来像是:b $ b看起来像是:
(从顶部开始)
#include< stdio.h>
#include< process.h>
#include< iostream.h>
#include" SelectOp.h"
#include" SelectOpGui.h"
>
extern void _stdcall SFTCK3(无效);
稍后,在代码中,我打电话:
案例8:
SFTCK3();
休息;
尝试构建时出现以下错误:
错误LNK2019:未解析的外部符号_SFTCK3 @ 0在函数中引用
_SelectOp_OnOperation,这将是上面的调用。
在c代码的'属性设置中,我确实有,unde其他依赖项:
c:\Temp \FAST_CSCI \SFTCK3 \SFTCK3.lib
我很确定它因为我没有将c和fortran连在一起,但是
不知道如何让这个工作。任何帮助,将不胜感激。谢谢
ATTRIBUTES DLLEXPORT::SFTCK3
It compiled ok, and created both a SFTCK3.lib and SFTCK3.dll
In the C code, I''ve tried a variety of online suggestions, but for now it
looks like:
(from top)
#include <stdio.h>
#include <process.h>
#include <iostream.h>
#include "SelectOp.h"
#include "SelectOpGui.h"
extern void _stdcall SFTCK3 (void);
later on, in the code, i call:
case 8:
SFTCK3();
break;
I get the following error when trying to build:
error LNK2019: unresolved external symbol _SFTCK3@0 referenced in function
_SelectOp_OnOperation, which would be the call made above.
In the c codes'' property settings, i do have, under additional dependencies:
c:\Temp\FAST_CSCI\SFTCK3\SFTCK3.lib
I''m pretty sure it''s because I''m not linking the c and fortran together, but
not sure how to get this working. Any help would be appreciated. Thanks
RichN写道:
我正在开发Visual Studio .NET 2003中的ac程序。我还有一个
Intel(R)用于MVS .NET的Fortran编译器
我的fortran源代码已经存在。我开始了一个新的fortran
项目,并选择创建一个动态链接库。 fortran代码的开头看起来像:
SUBROUTINE SFTCK3
!DEC
I am developing a c program in Visual Studio .NET 2003. I also have an
Intel(R) Fortran compiler for MVS .NET
My fortran sourcecode already existed. I started a new fortran
project and chose to create a dynamic link library. The beginning of
the fortran code looks like:
SUBROUTINE SFTCK3
!DEC
属性DLLEXPORT :: SFTCK3
<它已编译好了,并创建了一个SFTCK3.lib和SFTCK3.dll
在C代码中,我尝试了各种在线建议,但是现在它已经用了
看起来像是:
(来自顶部)
#include< stdio.h>
#include< process.h>
#include< iostream.h> ;
#include" SelectOp.h"
#include" SelectOpGui.h"
extern void _stdcall SFTCK3(void);
在代码中,我打电话给:
案例8:
SFTCK3();
休息;
我得到以下内容尝试构建时出错:
错误LNK2019:
函数_SelectOp_OnOperation中引用的未解析的外部符号_SFTCK3 @ 0,这将是上面的调用。
c代码的'属性设置,我确实有,在其他
依赖项下:
c:\Temp \FAST_CSCI \SFTCK3 \SFTCK3.lib
我很确定这是因为我没有链接c和fortran
在一起,但不知道如何让这个工作。任何帮助都将受到赞赏。谢谢
ATTRIBUTES DLLEXPORT::SFTCK3
It compiled ok, and created both a SFTCK3.lib and SFTCK3.dll
In the C code, I''ve tried a variety of online suggestions, but for
now it looks like:
(from top)
#include <stdio.h>
#include <process.h>
#include <iostream.h>
#include "SelectOp.h"
#include "SelectOpGui.h"
extern void _stdcall SFTCK3 (void);
later on, in the code, i call:
case 8:
SFTCK3();
break;
I get the following error when trying to build:
error LNK2019: unresolved external symbol _SFTCK3@0 referenced in
function _SelectOp_OnOperation, which would be the call made above.
In the c codes'' property settings, i do have, under additional
dependencies:
c:\Temp\FAST_CSCI\SFTCK3\SFTCK3.lib
I''m pretty sure it''s because I''m not linking the c and fortran
together, but not sure how to get this working. Any help would be
appreciated. Thanks
在STFCK3.lib导入库中使用dumpbin / symbols来查看
导出的符号名称是什么。这将给出解决方案的线索(
可能涉及更改您在C代码中使用的名称,或者在Fortran
代码中,或更改调用约定或者其他一些)。
-cd
Use dumpbin /symbols on your STFCK3.lib import library to see what the
exported symbol name is. That''ll give a clue to the solution (which
probably involves changing the name you use in the C code, or in the Fortran
code, or changing calling convention, or some such).
-cd
这篇关于c调用fortran子程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!