The scenario: Trying to use the Racket FFI to call a C functions that have arguments whose values should be taken from one or more #define'd constants, that might be different numbers on different OSes, making just hard-coding the values in Racket out of the question.
What's the best way of getting at these values? I found a c-defs package that looks promising (It basically compiles and runs a small C program that prints out the values of macros you want to get) but is there a way to automatically compile and run a script using it (To generate a Racket source file with all the values defined ahead of time that can be reused in that particular installation) when doing a raco install instead of compiling a C program every time my module is loaded?
Or if I make it an extension written in C that provides an interface directly instead of using the FFI, how do you make raco automate compiling a shared object? (Not looking forward to this idea as the documentation for writing extensions against the CS backend seems very scant; after skimming the Inside: Racket C API document I don't even see how to define a new variable or procedure from C)
Yes, I'll get on the POSIX committee about that...
EDIT: But speaking about C constants that have different values on different systems, it's frustrating that unsafe/ffi has a function to map an errno symbolic value like EAGAIN to a number, but not the other way around, or a way to export all known symbols...
Unfortunately, AFAIK, there is no portable equivalent to glibc's strerrorname_np. Probably it would be reasonably possible to do what you suggest for at least for what lookup-errno supports, but note that lookup-errno on Racket CS relies on hard-coded data.
If you want something fully robust, you probably have to compile a little C library like the unix-signals package does: