[plt-scheme] passing pointer from one FFI call as input into another FFI call
I have a C function that allocates a linked list of structs and it
works great until I try to pass it into another C function.
(define-cstruct _st_marker ([timestamp _int] [offset _int] [value
_int] [next _st_marker/null]))
;; int get_markers(char *filename, struct st_marker **marker_list)
(define get-markers
(get-ffi-obj "get_markers" "libvfm"
(_fun _string [markers : (_ptr o _st_marker-pointer/
null)]
-> [status : _int] -> (values markers status))))
I want to pass the value returned in 'markers' above to the function
below:
;; int create_event_list_from_marker_list(struct st_marker
*marker_list, struct st_event **event_list)
(define create-event-list-from-marker-list
(get-ffi-obj "create_event_list_from_marker_list" "libvfm"
(_fun [markers : (_ptr i _st_marker-pointer/null)]
[events : (_ptr o _st_event-pointer/null)]
-> [status : _int] -> (values events status))))
After searching for information on this, I saw on message that said
there are problems reusing the data bound using _ptr o as input into
another C function. Is there a different syntax I can use to
accomplish this?
Thanks,
Scott Hickey