Passing a 2 dimensional array from fortran to c++
- From: "Sam" <santosh.murki@xxxxxxxxx>
- Date: 29 Jun 2005 16:40:50 -0700
Hello all
I have a two dimensional array (the dimensions are not known) that
needs to be passed
to fortran from c++.
Say in my c++ code I have;
extern "C" { void foo_(float **, int &, int &); }
int main()
{
............
..............
int rows, columns;
float **array2d; // Now i need to pass this to the fortran code, the
allocation of the array and
// and filling it is done in the fortran code.
// How do i pass this to the fortran subroutine now, i did it this way
foo_(array2d, rows, columns);
// One more question, do i need to do the allocation and stuff here
again
// Do some stuff to manipulate with the array2d
return 0;
}
and my Fortran routine:
subroutine foo(arr,rows,columns)
integer rows, columns
real*8 ,allocatable:: arr (:,:)
! do some stuff to allocate the arrray and fil the stuff
end subroutine
It would be of great help if anyone could tell me how to do this
Regards
Sam
.
- Follow-Ups:
- Re: Passing a 2 dimensional array from fortran to c++
- From: glen herrmannsfeldt
- Re: Passing a 2 dimensional array from fortran to c++
- Prev by Date: Re: MODULEand USE versus Argument Passing
- Next by Date: Re: MODULEand USE versus Argument Passing
- Previous by thread: question about intel compiler
- Next by thread: Re: Passing a 2 dimensional array from fortran to c++
- Index(es):
Relevant Pages
|
|