The next snapshot build (available in 18 hours or so at
pre.racket-lang.org) includes a `#:custodian` optional argument to
`ffi-lib`. Probably you want `#:custodian (current-custodian)`, which
will unload the foreign library for a program run in DrRacket in
reaction to "Kill" or "Run".
Beware that `#:custodian (current-custodian)` will not interact nicely
with GC-based finalization via `register-finalizer` or
`ffi/unsafe/alloc`. If you have values to finalize,
`register-finalizer-and-custodian-shutdown` could be the way to go, but
beware that `register-finalizer-and-custodian-shutdown` provides no
ordering guarantee (unlike the `ffi/unsafe/alloc` interface). In other
words, there's still no simple answer to all problems, just a new
answer for some simple problems.
>
https://groups.google.com/d/msgid/racket-users/CAPsvE6L1Hw%2BeGjMJZ3MDzOJxw6WFT
> Ff_%3DmBRn9s6PxXJxZc3GQ%
40mail.gmail.com.