Thank you Danny for sharing your code, and all the others for sharing
your ideas and helping me out with this. Such a lively forum is the
best argument to use MinGW.
I thought I would post a wrap-up message for future reference with
some information about how I finally addressed the issue.
I ended up choosing the solution suggested by Ralf---using the tsearch
module in gnulib (I had to change tsearch.c and search.h a little,
though, to get things working). The program now compiles and runs in
Windows. This solution, however, required using autoconf and automake,
with which I was not really familiar.
I was willing to (auto)make the extra effort to learn that stuff, but
I am not sure whether other people with the same problem will do the
same, so I still think that providing these functions in MinGW would
be helpful (if Danny's code is added to libmingwex, though, tdestroy
would be nice to have, too). As I already mentioned, a minor
additional annoyance during the process is that there is already a
search.h in MinGW, which does not correspond with those in gnulib or
If anyone things that I can be helpful in adding these functions to
MinGW, please do not hesitate to ask (although, remember, I am no real