Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

for_rtl_init not found

rzamudio
Beginner
497 Views
I am working with Intel Visual Fortran 9.0. I am retrying to build a C++ application in Visual Studio 2003 that calls a Fortran function from a library I have created. I want to call for_rtl_init from the C code to establish the error handlers. Everything compiles OK, but I get the following linker errors

Linking...
mainApp.obj : error LNK2019: unresolved external symbol "int __cdecl for_rtl_finish_(void)" (?for_rtl_finish_@@YAHXZ) referenced in function __catch$_WinMain@16$0
mainApp.obj : error LNK2019: unresolved external symbol "void __cdecl for_rtl_init_(int *,char * *)" (?for_rtl_init_@@YAXPAHPAPAD@Z) referenced in function _WinMain@16
Debug/mainApp.exe : fatal error LNK1120: 2 unresolved externals

My code, more or less, is:

void for_rtl_init_(int *, char **);
int for_rtl_finish_();

int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR Args, int WinMode)
{
// parse command line

for_rtl_init_(&argc, argv);

rv = fortran_func( );

// process lots of return values

io_status = for_rtl_finish_();
}

I have included libifcoremt in my C project dependencies and have the fortran lib directory in my search path, but the linker doesn't find these functions. Can anyone who has use for_rtl_int() from C give me some advice?
0 Kudos
2 Replies
Steven_L_Intel1
Employee
497 Views
For C++, you need extern "C" in front of those for_rtl_xxx declarations.
0 Kudos
rzamudio
Beginner
497 Views
That was it. Thanks.
0 Kudos
Reply