1.9. cstruct declaration

The cstruct keyword can be used like struct, and has the same effect, except that no struct is actually generated by Felix, instead, the nominated struct is assumed to be defined in embedded C/C++ header code somewhere.
Start felix section to tut/embedding/bind-1.08-0.flx[1 /1 ]
     1: #line 665 "./lpsrc/flx_tut_bind.pak"
     2: #import <flx.flxh>
     3: 
     4: header """
     5: struct X { int a; int b; };
     6: """;
     7: body """
     8: X rev(X x) { X y; y.a=x.b; y.b=x.a; return y; }
     9: """;
    10: 
    11: cstruct X { a: int; b: int; };
    12: fun rev: X -> X = "rev($a)";
    13: val x:X = X(1,2);
    14: print x.a; print " "; print x.b; endl;
    15: val y:X = rev x;
    16: print y.a; print " "; print y.b; endl;
End felix section to tut/embedding/bind-1.08-0.flx[1]
Start data section to tut/embedding/bind-1.08-0.expect[1 /1 ]
     1: 1 2
     2: 2 1
End data section to tut/embedding/bind-1.08-0.expect[1]