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

Including FORTRAN DLL in C++ Project



I already searched a lot in the internet, but did not find an answer that works for me. As the topic already says I have a C++ solution/project and want to use a DLL and a lib created with FORTRAN. I added the lib at "Additional Dependencies" of the project and the DLL as well as the lib is in the same folder as my solution/project. Here is a piece of my code, that hopefully is enough to localize the problem:

using namespace std;
	typedef void(*__FABER1_DLL)(int   *IDFEIN,  float *RFEIN,   int  *JFEIN,  char **CFEIN,
		                    int   *IDFAUS,  float *RFAUS,   int  *JFAUS,  char **CFAUS,
		                    int   *MENZFE,  int   *MEMRFE,  char **MECSFE,
		                    int   **MEI4FE, float **MER4FE, int  **MEKTFE);
	typedef void(*__FECIFE_DLL)(int   *IDFEIN, float *RFEIN, int  *JFEIN, char **CFEIN,
		                    float *RINIT,  int   *JINIT);
int main(int argc, char **argv)

	if (!(h_FORTRAN_dll = LoadLibrary("AsIntf.dll")))
			printf("\n*** AsIntf.dll not found. Aborting.\n"); exit(-1); return 0;
	_FABER1 = (__FABER1_DLL)GetProcAddress(h_FORTRAN_dll, "_FABER1");
	_FECIFE = (__FECIFE_DLL)GetProcAddress(h_FORTRAN_dll, "_FECIFE");

// declarations of variables

// Calling the function:


// "JFEIN" is an input value, and "RFAUS" should send back a value.

The code can be built and it is possible to debug. But when I want to see the value of "RFAUS" I get "Error/No Values/Wrong programming area".


Has anyone an idea what could go wrong?

Thank you, Alex



0 Kudos
1 Reply
Black Belt Retired Employee

Might you show us the header of the Fortran routine(s) - SUBROUTINE statement, declarations of all arguments and any directives? Please also show us the command line used to compile the Fortran code. 32-bit or 64-bit? I can think of several possibilities, but would prefer to wait until I saw more data.