Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
7646 Discussions

passing C structures to a Fotran Dll

I wanto to pass a C structure to a fortran dll. the code I am using is given beloww C: Part struct sTempo { int id; int Type; int EquationType; int Dim; double *Dx; }; sTempo* Net = new sTempo; Net->Dx = new double [100]; for(int j=0; j<100; j++) Net->Dx=j; Net->Dim=100; pHKernel( &Net[0]); Fortran code: MODULE myMODULEGLOBAL TYPE Param1 INTEGER(4) :: Val INTEGER(4) :: Start INTEGER(4) :: pp REAL(8), POINTER :: Values(:) END TYPE Param1 END MODULE myModuleGlobal subroutine pHFKernelDLL (pImput) USE myMODULEGLOBAL implicit none !DEC$ ATTRIBUTES DLLEXPORT::pHFKernelDLL !DEC$ ATTRIBUTES REFERENCE :: pImput TYPE (Param1) :: pImput ALLOCATE (pImput%Values(100)) the problem is that I can get the values in the fortran Dll that were set in the calling C program. Any ideas ?????????
0 Kudos
1 Reply
please use code editor to post any source code.

There is a section talking about mixed language programming in the Intel Visual Fortran for Windows documentation. Please refer to that for detail.

But in general, use /Gz when compiling the C/C++ file that calls the Fortran code or adding following:
extern void __stdcall FORTRAN_RTN(int a, int b);