Closed
Description
Here is an example of how pointers should be manipulated, in Fortran, Python, both should generate the same ASR, and the C backend should then generate the output below:
Fortran:
type(c_ptr) :: queries
integer(2), pointer :: x(:)
c_f_pointer(queries, x)
c_loc(x(idx))
Python:
from ltypes import c_loc, c_p_pointer, CPtr, Pointer
from typing import Annotate
queries: CPtr
x: Annotate[i16[:], Pointer]
x = c_p_pointer(queries, i16)
c_loc(x[idx])
C output:
void *queries;
int16_t *x;
x = (int16_t*)queries;
&x[idx];
Also allow passing void *
pointers as arguments to functions.
Metadata
Metadata
Assignees
Labels
No labels