- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
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; HINSTANCE h_FORTRAN_dll; 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); __FABER1_DLL _FABER1; typedef void(*__FECIFE_DLL)(int *IDFEIN, float *RFEIN, int *JFEIN, char **CFEIN, float *RINIT, int *JINIT); __FECIFE_DLL _FECIFE;
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:
_FABER1(&IDFEIN, RFEIN, JFEIN, CFEIN, &IDFAUS, RFAUS, JFAUS, CFAUS, &MENZFE, &MEMRFE, MECSFE, MEI4FE, MER4FE, MEKTFE);
// "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
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page