- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using the routines provided in the DESCRIPT.F90 example to extract from the array descriptor the address of the first element of a pointer array.
I then pass this address to a C routine, together with array dimensions; the array will be further manipulated in the C part of the code.
As described in the CVF documentation (Programmers Guide, 18.3.4) the address of the start of the array should be
d%base + d%offset. However, my C program did not recognize the start of the array when using this location, and it worked perfectly well when using d%base (w/o adding the offset value).
d%base + d%offset. However, my C program did not recognize the start of the array when using this location, and it worked perfectly well when using d%base (w/o adding the offset value).
Is there something wrong in the way I am interpreting the code in the Descript module?
I am worried that the workaround was pure chance and that it wont work in the future, when deployed in an actual application.
See the attached workspace files and source code in the ANN_Workspace.ZIP file.
Marcello Cattaneo
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, you're actually perfectly fine with D.base (without seeing your code).
Actually, as far as I know, D.offset only compensates for the fact that Fortran arrays are 1-based, so that further computation is slightly simpler.
So, X(i) = *(D.base + D.offset + i*D.sizeof)
(I'm not sure what's the value of D.offset for Fortran arrays with starting index other than 1 though.)
Jugoslav
Actually, as far as I know, D.offset only compensates for the fact that Fortran arrays are 1-based, so that further computation is slightly simpler.
So, X(i) = *(D.base + D.offset + i*D.sizeof)
(I'm not sure what's the value of D.offset for Fortran arrays with starting index other than 1 though.)
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks ... I was under the impression that offset referred to a memory offset!
Marcello
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