help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Include Fortran Code which Returns Arrays of Dynamic/Unknown Size


From: Marco2008
Subject: Re: Include Fortran Code which Returns Arrays of Dynamic/Unknown Size
Date: Fri, 10 Oct 2008 08:58:46 -0700 (PDT)


Jaroslav Hajek-2 wrote:
> 
> in terms of Fortran 2003/Interoperability with C, allocatable arrays
> are not interoperable. These arrays are always passed by array
> descriptor (allocating descriptor and passing its address), but how
> exactly the descriptor looks is completely compiler-dependent. Also,
> note that it is Fortran runtime library that allocates the array, but
> presumably C++ runtime library should deallocate it, which is almost
> bound to cause trouble.
> The easiest portable way to achieve what you need is to first make a
> special "query" call to the Fortran subroutine that will only return
> the array size, allocate it in C++, and then invoke a normal call.
> This is, for instance, how LAPACK works.
> 

Thanks a lot for this post. I will try to implement my algorithms in the way
you described. Maybe there is one drawback. If the "query" call computes
some results for further computations they are lost with the end of the
"query" call and have to be recomputed in the second call. This can decrease
the performance of the algorithm. 

Regards
Marco

-- 
View this message in context: 
http://www.nabble.com/Include-Fortran-Code-which-Returns-Arrays-of-Dynamic-Unknown-Size-tp19845758p19921088.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]