Shop OBEX P1 Docs P2 Docs Learn Events
How to use {++ } feature in spin2cpp? — Parallax Forums

How to use {++ } feature in spin2cpp?

SRLMSRLM Posts: 5,045
edited 2013-06-29 11:52 in Propeller 1
How do I use the spin2cpp feature to pass through code to the C++ output? I tried
{++
// my comment
}

and
{++
// my comment
;
}

and
{++
//
// and here are the C versions of the methods
//
int32_t test95::Square(int32_t x)
{
  return x*x;
}
}

And I get
../spinsource/quadrature_encoder.spin:48: syntax error
The line reference is the line immediately following the {++ } annotated block.

What am I missing?

Comments

  • ersmithersmith Posts: 6,054
    edited 2013-06-29 11:52
    I can't tell from what you've posted; it looks like it should work. It may be that your particular form of {++ has to go after a PUB or PRI declaration (I think I've only really tried testing C++ functions after Spin functions). See for example Test/test95.spin in the spin2cpp source code:
    { indicate to spin2cpp that it should not output Spin methods }
    {++!nospin}
    
    { the Spin version of the methods }
    PUB Square(x)
      return x*x
    
    {++
    //
    // and here are the C versions of the methods
    //
    int32_t test95::Square(int32_t x)
    {
      return x*x;
    }
    
    }
    
Sign In or Register to comment.