xpidl and #ifdef
You may be surprised to find that the Mozilla xpidl compiler doesn't support #ifdef, which seems to be the right way to conditionally define members in your IDL files. So how are you supposed to define debug-only stuff, for example?
Turns out it's quite possible through a flexible passthrough mechanism. Just wrap your C++-isms in blocks like this:
%{C++
#ifdef DEBUG
%}
readonly attribute long myDebugStuff;
%{C++
#endif
%}
This will appear as expected in the generated .h file. Thanks, Darin, for the tip!
Update 2/22/2007: This is just enough rope to hang yourself. Be careful about mismatches between the caller and callee's understanding of the vtable layout!

Leave a comment