Detouring of function calls is done via the C preprocessor. In fact the current code is most probably invalid in 64Bit environments since MX_COMPAT_32 isn't handled correctly yet.
I forgot to mention that any combination of ARRAY_ACCESS_INLINING, MX_COMPAT_32, ARGCHECK needs to be handled.
Even the Matlab devs seem to be unsure about that:
" #if 0 /* * Conflicts with 32-bit compatibility (-> MX_COMPAT_32) * Needs revisiting. Is this layer still worthwhile? * XXX */ #ifdef ARGCHECK "