
14 Jul
2009
14 Jul
'09
11:28 p.m.
On Tue, Jul 14, 2009 at 9:51 PM, Maurício
I'm trying to define a macro inside a template that generates an existing macro:
---
#define hsc_test(hst,ct) \ { \ printf("#def inline int b_%s(void){return %s;}\n", hst,ct); \ printf("foreign import ccall b_%s :: CInt\n", hst); \ }
---
Contrary to my expectation, the '#def' construct printed at the first 'printf' is included in the final haskell file, instead of beeing removed and replaced by a C function definition in a c header file.
I thought CPP igored tokens occurring in strings? So CPP wouldn't even see the #define in the argument to printf. I'm not a C wizard, but I though that's how it worked. Antoine