I don't think qsort changes anything about the mechanism described in the blog post, but maybe I'm missing something. (I.e., use qsort_r...)
(qsort is really only for C. Other languages can potentially inline the comparison function, so using FFI for that is kind of insane.)