This currently works: //------------------------------------------------------------ // interface.flx //---------------------------------------------------------------- fun distance: double * double -> double // requires header 'extern "C" double distance (double,double);'; requires header '#include "implementation.hpp"';
//------------------------------------------------------------- // implementation.flx //---------------------------------------------------------------- include "interface"; cfun distance_impl (x:double, y:double) => sqrt (sqr (x) + sqr (y)); export cfun distance_impl of (double * double ) as "distance"; //---------------------------------------------------------------- // client.flx //---------------------------------------------------------------- include "interface"; println$ distance (1.0, 2.0); ~/felix>build/release/host/bin/flx --test=build/release -c --static --nolink -od . implementation ~/felix>build/release/host/bin/flx --test=build/release --static -od . implementation.o client 2.23607 In the interface, the header generated by compiling the implementation can be #include'd instead of manually defining the prototype. That file has a guard which prevents it being #include'd twice when compiling the implementation. It's a bit ugly .. It also works (now) with "fun" instead of "cfun" for distance_impl, however the export has to be declared "cfun". The implementation function in this case has to have a distinct name from the export. The caveat here is: the function arguments and types HAVE to be ordinary C/C++ types. You cannot use a Felix type, not even a struct. -- john skaller skal...@users.sourceforge.net http://felix-lang.org ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language