VC调用Fortran的DLL!!着急!!
fortran 源码如下:
! ggg.f90
!
! FUNCTIONS/SUBROUTINES exported from ggg.dll:
! ggg - subroutine
!
subroutine ggg(v1,v2,r)
implicit none
! Expose subroutine ggg to users of this DLL
!
!DEC$ ATTRIBUTES DLLEXPORT::ggg
! Variables
real v1,v2,r
r=sqrt(v1*v1+v2*v2)
! Body of ggg
end subroutine ggg
建立一个win32有hello world 输出:
源代码如下:
//
#include "stdafx.h"
extern "C" void ggg(float v1,float v2,float &r);
extern "C" _declspec(dllexport)
void _stdcall C_Callfor(float a,float b,float &c)
{
ggg(a,b,c);
}
int main(int argc, char* argv[])
{
float a,b,c;
a=3.0;
b=4.0;
C_Callfor(a,b,&c);
printf("Hello World!\n");
return 0;
}
此过程我已经将ggg.lib 和ggg.dll加载到当前工程!!
编译Vc不通过,如下:
--------------------Configuration: cpp - Win32 Debug--------------------
Compiling...
cpp.cpp
Linking...
Creating library Debug/cpp.lib and object Debug/cpp.exp
cpp.obj : error LNK2001: unresolved external symbol _ggg
Debug/cpp.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
cpp.exe - 2 error(s), 0 warning(s)
求求求!!