I am trying to call a fortran subroutine from C++. The difficulty which I
am facing is the following.
Inside C++, I am calling a fortran subroutine;
void testfortran(double) ;
.......................
testfortran(1.0);
The following is the fortran subroutine which I defined.
subroutine testfortran(x)
implicit none
integer,parameter :: dp = kind(1.0d0)
real(kind=dp),intent(in) :: x
print *, "======== test ========"
print *, "Inside Fortran : " <======= 1
print *, x <======= 2
end subroutine
It looks like everything is working fine up to the point 1, but when it
reached point 2 it stops working as can be shown in the following error
message. Based on the error message, it looks like the double variable x
is not allocated at all. Can anyone tell me how I can fix this ? Calling
another subroutine without passing any variable works O.K.. I just have
difficulty in passing data to the fortran subroutine. Thanks.
======== test ========
Inside Fortran :
*** FORTRAN I/O ERROR 1004: DATA UNALLOCATED OR NOT PRESENT
FILE: , UNIT: 6
( 0) 0xc1667994 __io_ded + 0x304 [/usr/lib/pa1.1/libcl.1]
( 1) 0xc165f7c4 ____F90_END_IO + 0x864 [/usr/lib/pa1.1/libcl.1]
( 2) 0x000225c4 testfortran + 0xbc [./radiosity]
( 3) 0x00022eb8 main + 0x784 [./radiosity]
( 4) 0xc0065414 _start + 0x8c [/usr/lib/libc.1]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|