I wanted to add one thing to this very useful thread, if only to have a record of it somewhere:

On 17 September 2011 18:33, Dave Tapley <dukedave@gmail.com> wrote:
For the curious:
Wondering how the library can still compile with some includes missing?
(I believe, perhaps someone can confirm...)
If you inspect some of the .cpps under wxcore/src/cpp/ you'll find they do a bunch of ifdefs (for example ifdef wxUSE_MEDIACTRL).
Where do these defines come from?
Well in Setup.hs you'll find this:
>  (readProcess "wx-config" ["--libs", "--cppflags"] "")
And that "cppflags" flag will print out (or in our case, on Linux, not print out) things like (wxUSE_MEDIACTRL), these are passed to "ccOptions" (from Distribution.InstalledPackageInfo), and the build system then passes these to the CPP linker.

There is a horrible hack in the way this is implemented, which is that wxhaskell actually compiles stub code for all of the APIs for which you don't have the required library, and has the functions return 'benign' (usually NULL) values.

I have never liked this - it is down to the fact that wxdirect doesn't handle the preprocessor, so you cannot put conditional compilation in the core wxC headers. Yet another item for the TODO list.

Jeremy