Dear all,
maybe this is a piece of c2hs behaviour I missed to understand, but it appears happening with C++ style includes deep in the header call hierarchy – in case of a such backend C++ library, if one wishes to refer to by *.h's in c2hs (e.g. for access to types of it), one might have a problem.
- 8< cSample.h ---------------------------------------------
#include <iostream> ///////// here, with c2hs, leading to build abort
#ifdef __cplusplus
extern "C" {
#endif
void sampleFunction();
#ifdef __cplusplus
}
#endif
- 8< cSample.cpp ---------------------------------------------#include "cSample.h"
#include <iostream> ///////// here no problem
void sampleFunction(){
std::cout << "OK" << std::endl;
}
- 8< ----------------------------------------------------------------
While 'old school' FFI (foreign import ccall) handles this effortlessly, c2hs uses to abort with an exception like
C/cSample.h:3:20: fatal error: iostream: No such file or directory
compilation terminated.
I see that hsqml gets around this, but apparently by tweaking Setup.hs in a way not quite trivial – would this be necessary in any case, or are there simpler alternatives?
Please excuse if I oversaw something, but I am afraid I didn't see this interesting issue covered elsewhere.
Thank you a lot in advance & cheers, Nick