This is a minor bug. Seems that xmingw-w32api will complain that stdlib.h and other header files are missing unless xmingw-runtime is installed. I looked at the ebuild, and it should have the dependency dev-util/xmingw-runtime. I was able to emerge xmingw-w32api after I had emerged xmingw-runtime, which I found out was not installed before, due to the missing dependency.
Looks like this package is also missing metadata.xml.
The fix is not quite as simple as making xmingw-runtime a dependency of xmingw-w32api as runtime itself requires w32api to be installed. This is a bootstrap situation (chicken egg situation). What happens is runtime is untared in the build directory of w32api so the headers can be used. But it seems that w32api is not picking them up anymore. That is what I need to fix.
Ok, found it. I assume the build only failed in the directx directory? Because the Makefile there is slightly broken so it is not looking for the headers in the correct place. Patched the makefile so it looks i the correct place and it seems to bootstrap ok again.