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

IVF 8.0 and VS.net Mixed Language Programmin

Deleted_U_Intel
Employee
270 Views
First, I apologize for asking a question that's probably aleady been answered by Steve a dozen times.I'm using IVF 8.0.1877.2003 and VS.net2003. I have a mixed FORTRAN and C language solution where I've put all the FORTRAN code into a project that builds a static library and the C code into a separate project that builds Win32 executable. The C code does all the GUI stuff, calls the FORTRAN code to crunch numbers, and the FORTRAN code passes some status info back to the C Code which displays the info in a status window. I have the build order of the projects set so that the FORTRAN builds first and then the C code. Here are the pertinent code chunks:
In the C header file
extern int __stdcall VORINP( int*, int*, int* );
In the C code
void HandleExecuteVorlax(...) {
int arg1, arg2, arg3;
...
dum = VORINP( &arg1, &arg2, &arg3)
...
}
In the FORTRAN code
INTEGER*4 FUNCTION vorinp( var1, var2, var3 )
INTEGER*4 var1 [REFERENCE]
INTEGER*4 var2 [REFERENCE]
INTEGER*4 var3 [REFERENCE]
...
vorinp = 1
return
When linking, I get the error

vorexecute.obj : error LNK2019: unresolved external symbol _VORINP@12 referenced in function _HandleExecuteVorlax

I originally coded this up using CVF 6.6 and VS 6.0, and everything worked fine. I then migrated to VS.net2003 and was able to make this work by building the FORTRAN as a static library and adding it as a resource to the C code project. Unfortunately, however, I'm stumped as to how to make this work with the IVF compiler.
Thanks in advance for any help!
Doug
0 Kudos
3 Replies
Steven_L_Intel1
Employee
270 Views
Take out the __stdcall in the C declaration of the Fortran routine. Intel Fortran does not use STDCALL as the default.
0 Kudos
Steven_L_Intel1
Employee
270 Views
Do you also get errors that libraries are not found? You may need to add the paths to the IVF libraries to your Tools..Options..C++..Directories (I think - I'm not using a PC with the compiler installed right now.)
0 Kudos
Steven_L_Intel1
Employee
270 Views
Well, I do check in here off hours...

I can't tell from your description just what you have so far. Can you upload a zip file that has your .sln, .vcproj, .vfproj and .log files from the solution?
0 Kudos
Reply