Consider the following C++ that calls a function once to learn how much it 
should allocate for a vector, and again to populate said vector.

uint32_t count;

vkEnumerateInstanceLayerProperties(&count, NULL);

std::vector<VkLayerProperties> properties(count);

vkEnumerateInstanceLayerProperties(&count, properties.data());

Below is my generated signature so far. The docs for 
[_list](https://docs.racket-lang.org/foreign/foreign_procedures.html?q=_fun#%28form._%28%28lib._ffi%2Funsafe..rkt%29.__list%29%29)
 shows similar examples, but they assume either the length of the vector is 
known in advance.

How would I make a custom function type to manage both o1 and o0 values with 
the garbage collector, call the function twice as described, and return the 
value for o1 in a single call?

(define-vulkan vkEnumerateInstanceLayerProperties
  (_fun (o0 : (_ptr o _uint32_t))
        (o1 : (_ptr o _VkLayerProperties))
        -> (r : _VkResult)
        -> (begin (check-vkResult r (quote vkEnumerateInstanceLayerProperties))
                  (values o0 o1))))

~slg

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/Vo2OHZYjsSlsnJojlfmw5yolaYJWQzqlunk7S24hrnFb4Lk1jz0kqe2RCGM_aPFXxeVQfRqDPM2p7GKeN_drxRoi2Q9ZGu2srPhAme7LCAk%3D%40sagegerard.com.

Reply via email to