I'm still struggling with this. Felix has a couple of ways to deal with it.
1. Conditional code generation: lib/plat. Done at config time. 2. C++ conditional stuff. Eg async I/O, pthreads etc. 3. Felix conditional compilation. This is used in Faio at the moment. 4. Abstraction by virtual functions. This is "apparently" nice. You can compile both windows and unix code instances, and just select one using a dummy type. But dummy types suck. Also, this only handles functions common to all platforms. It doesn't handle, say, rejection of platform dependent code, or, using say an XSI function on a non-XSI posix platform. There's a need to think. First, Felix code SHOULD be able to generate either Unix or Windows code, no matter what the host is. The target could be otherwise: we don't have to compile the generated C++ on the platform that generates it. AHHHH .... Eureka... C++ with conditional compilation is how Felix makes portable RTL code. So the right way to write "platform independent" code is NOT conditional compilation in Felix .. but conditional compilation in C++ .. GENERATED BY FELIX. In other words instead of proc f() { if windows do windows_f(); else posix_f() done } which generates code for either windows or posix, we should be generating this: proc f() { hash_ifdef_windows(); windows_f(); hash_else(); posix_f(); hash_endif(); } which generates: void f() { #ifdef WINDOWS C_windows_f(); #else C_posix_f(); #endif } so the conditional testing is done at C++ compile time. Of course this won't play with requirements for header files, since both windows and posix headers needed by the C functions will be included, so we need to #ifdef them too. Of course the syntax above is only a demo that will work right now (not real syntax for this feature). The above Felix generates a "universal source" sort of like Apples universal binaries. Of course it won't "properly" work as written because Felix generates, say, functions, in pieces: struct f_type; ... struct f; .. struct f : f_type{ ... }; void f::call(); etc. So really we want to tag the code "for windows" so all the parts of the function as above get conditionals around them .. hmmm ... -- john skaller skal...@users.sourceforge.net http://felix-lang.org ------------------------------------------------------------------------------ For Developers, A Lot Can Happen In A Second. Boundary is the first to Know...and Tell You. Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! http://p.sf.net/sfu/Boundary-d2dvs2 _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language