- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 ?????????
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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);
Jennifer
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);
Jennifer

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