News for hackers. Stuff that matters.
Re:Neat Rust Tricks: Passing Closures to C by dfox on Monday November 25, 2019 @08:07PM (#21634764)
qsort(3) or even ftw(3) is the simple case. You can either dynamically generate trampoline code with exactly bounded dynamic scope (and even do the gcc-style executable stack hack) or simply stash the whole context in some TLS region and completely sidestep the whole issue.

Side point: ftw(3) is much more interesting unix API to call from some FFI layer than qsort(3). And I spent about a year pestering people from Sun with you should implement fts_open(3) and friends because it presents more sane API for FFIs for the same functionality.

Re:Neat Rust Tricks: Passing Closures to C by wahern on Monday November 25, 2019 @09:45PM (#21635231)
And it appears that you succeeded. Awesome!

It seems Solaris has been adding many BSD and, especially, Linux compatibility APIs lately. It seems too little, too late; or perhaps the initiative is part of their effort to EoL Solaris, providing an upgrade path to Linux.

Re:Neat Rust Tricks: Passing Closures to C by dfox on Tuesday November 26, 2019 @01:13PM (#21640958)
Well in fact I gave up about 10 years ago :)