Is it possible to have an object X so that some function gets called when X is gc-ed?

Suppose I have something like

(define-type foo ...)
(define bar (foo-create ...))

and inside of bar, there's a C-land resource that I want to have freed up when bar is GC-ed;

Is there a way to have some function like (foo-gc) s.t. when bar is GC-ed,
(foo-gc bar) is called?

Thanks!