Monday, April 03, 2006

Day 335

We decided it was time to tidy up the diagnostics for the product, so I spent today going through the code converting it to use an C++ trace framework that I wrote back in 2000. Getting a basic version running under Windows was straightforward, but it seems the more advanced features are going to be harder to port—inter-process locking and memory-mapped files and suchlike.

I'm sure there are ways of doing what's needed in Win32, but it's just so much more of a pain in the arse to program to than the equivalent UNIXy APIs. In UNIX-land, you can figure out what's needed just from the API documentation, but in Windows-land you don't have any chance of getting things working unless you've got some sample code to work from. Anne told me about a friend who had to use a new Microsoft API that didn't come with any sample code; in the end, he had to use a perl script to autogenerate every possible variant of the code to use the API, and run them all to see which one worked.

I could definitely do with a decent low-level Win32 API book. Ideally, an equivalent to Stevens—in fact, a translation guide which covered how to achieve equivalent effects under Win32 would be perfect.

[Edit 16-Jun-06: Johnson Hart's Windows System Programming has a helpful appendix comparing Win32 with POSIX and libc.]

No comments: