RE: [Template-haskell] Profiling with Template Haskell
| > Then, all you need do is | > compile C-code without -prof | > compile R-code with -prof | | But we only have one kind of "import", which imports a module both at compile-time and run-time. | You'd be forced to link in the C-code modules in the final program, and I'm pretty sure something will | go wrong even if the program doesn't end up referring to anything from those modules.
Ah... you mean the module initialisation tree will still kick in. Hmm. But if a module is pure C-code, the mod-init code will still work even if it's compiled without -prof, wont' it? Admittedly, the c-module would then a (redundant) part of the runtime executable
I realised you'll get a link failure, because the init function contains the build tag, so it's impossible to link non-prof code with prof code (this is a safety feature :-). So, you still need to compile any module which contains compile-time code as both prof and non-prof. The latter will be used at compile time only. There might be some confusion over interface files: GHC will read the profiled interface, so it better be consistent with the non-prof interface, which describes the code we're going to load and run at compile time. One way which is guaranteed to work is to put the compile-time code into a package. Cheers, Simon
participants (1)
-
Simon Marlow