I have a problem passing the function of AC function from FORTRAN: The array is defined in Fortran.
real (kind = real_arge), dimension (:), allocatable :: array call cFunc (array) if cFunc
Zero cFunc (double * data) {...} The data contains only "garbage" values Where is the problem in this case? (This solution works well with integer).
Edit thx: My Platform: Compiler: VS 2008, Intel Compiler Version 11 OS: Win7
2: I define the interface for C-function like this (The code gets less than one element, which can cause problems, actual functions have more parameters):
interface c_interface sub-root cFunc (array) bind (c, name = " CFunc ") iso_c_binding real (c_double), dimension (*) :: memory end in FORTRAN memory ALLOCATE (array (number Yaanafelements)) call is assigned cFunc (array) to
At the moment I get a runtime error "floating-point overflow" array right element in some cases.
@ High Performance Mark's suggestions are very good, and I highly recommend Fortran and C. For the potential of the difference, the ISOCADBiding of Fortran 2003 (supported by many editors compilers) - here is a big issue that makes ISOOCBIDID more useful: If the foreign arrocatable arrays are more complex, then simple arrays. If you "hack it" and pass an indicator directly into the C code, you can describe an indicator for the inner structure of Fortran rather than the sequence of numerical values rather than the pointer. Allocated arrays are not directly supported by ISO_C_Binding, but if you write an ISO_C_Binding interface (contrary to what was originally written) - "Fortran 95/2003 explained" book says that the compiler is regularly called That it will copy-in / copy-out to get an allocated array and match array.
PS My guess is that for a simple allocated real argument, copy-in / copy-out should not be necessary. When the compiler recognizes through a clear interface (which can be an ISOBBID interface) that if the dummy argument of the routine is not an allocation, then the compiler should remove the pocket in the actual array from the allocation details. In some cases, copy-in / copy-out will be required as passed logic, such as an indicator for a non-narrow array, such as the non-unit Pointer with string (for example, pointer which indicates elements 1, 3, 5.). But without any interface, the compiler will probably pass the descriptor of the allocated array, which will not expect C. ...
Comments
Post a Comment