| 1 |
#include <stdlib.h> |
| 2 |
#include <string.h> |
| 3 |
#include <ISO_Fortran_binding.h> |
| 4 |
|
| 5 |
|
| 6 |
extern int do_loop(CFI_cdesc_t* array); |
| 7 |
|
| 8 |
int main(int argc, char ** argv) |
| 9 |
{ |
| 10 |
int nx = 9; |
| 11 |
int ny = 10; |
| 12 |
int nz = 2; |
| 13 |
|
| 14 |
int arr[nx*ny*nz]; |
| 15 |
memset(arr,0,sizeof(int)*nx*ny*nz); |
| 16 |
CFI_index_t shape[3]; |
| 17 |
shape[0] = nz; |
| 18 |
shape[1] = ny; |
| 19 |
shape[2] = nx; |
| 20 |
|
| 21 |
CFI_CDESC_T(3) farr; |
| 22 |
int rc = CFI_establish((CFI_cdesc_t*)&farr, arr, CFI_attribute_other, CFI_type_int, 0, (CFI_rank_t)3, (const CFI_index_t *)shape); |
| 23 |
if (rc != CFI_SUCCESS) abort(); |
| 24 |
int result = do_loop((CFI_cdesc_t*)&farr); |
| 25 |
if (result != nx*ny*nz) abort(); |
| 26 |
return 0; |
| 27 |
} |