Hi Dmitry and Matthew,
Thanks for your suggestions, which, although quite different, turned out
to be both useful for me. As you can imagine, my real C API is a lot
more complicated. There are dependencies between allocated memory
blocks, i.e. freeing one can invalidate another one. More fine-grai
I think I haven't run into this because `r` and `foo` are usually
combined into one value that's more Rackety. Maybe `allocator` should
have a `get-result` optional argument similar to `deallocator`.
Meanwhile:
;; Not exported:
(define-fooapi make_foo
(_fun (foo : (_ptr o _foo))
->
Konrad,
I would create a wrapper like this:
(define-fooapi make-foo
(_fun (foo : (_ptr o _foo)
-> (r : _int)
-> (if r (begin (register-finalizer-and-custodian-shutdown foo
destroy-foo) foo)
(error "can not make foo")))
Regards,
Dmitry
On 01/2
3 matches
Mail list logo