Re: How to link a Fortran static library to a C++ program?
- From: "N. Shamsundar" <shamsundar_at_@xxxxxx>
- Date: Thu, 30 Mar 2006 08:16:50 -0600
Guch Wu wrote:
I build a Fortran static library whitch has a function using IntelRead your compiler documentation as to mixed language linkage. Intel Fortran does not use STDCALL linkage in its default mode. Remove "_stdcall" from the C caller and things will work fine.
Visual Fortran 9.0. There is a function as follow:
subroutine sub(a)
implicit none
integer :: a
write(*,*) a
return
end subroutine
Now I link it to a C++ program in Visual C++ 2003:
#pragma comment( lib, "FLib.lib" )
#ifdef __cplusplus
extern "C"{
#endif
void _stdcall SUB(int *a);
#ifdef __cplusplus
}
#endif
int main(int argc, _TCHAR* argv[])
{
int a = 10;
SUB(&a);
return 0;
}
When building the C++ project, there is a problem:
error LNK2019: unresolved external symbol _SUB@4 referenced in function
_main
How can I fix the problem?
N. Shamsundar
University of Houston
.
- Follow-Ups:
- Re: How to link a Fortran static library to a C++ program?
- From: Guch Wu
- Re: How to link a Fortran static library to a C++ program?
- From: Guch Wu
- Re: How to link a Fortran static library to a C++ program?
- References:
- How to link a Fortran static library to a C++ program?
- From: Guch Wu
- How to link a Fortran static library to a C++ program?
- Prev by Date: Re: Structure of large link libraries in f95
- Next by Date: Re: How to link a Fortran static library to a C++ program?
- Previous by thread: How to link a Fortran static library to a C++ program?
- Next by thread: Re: How to link a Fortran static library to a C++ program?
- Index(es):
Relevant Pages
|