"extern" keyword for multiple return value function

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
Lele
Active Member
Posts: 52
Joined: Mon Oct 31, 2011 4:08 pm

"extern" keyword for multiple return value function

Post by Lele »

I use to put "extern" keyword for function protoype in header files. Not a big issue but it seems not to be accepted for xc functions returning multiple values.
example .xc file:

Code: Select all

int SimpleFunction(void)
{ 
  return 1;
}

{ int, int, int} MultipleReturnValueFunction(void)
{  
  return { 1, 2, 3 };  
}
and .h file:

Code: Select all

...
extern int SimpleFunction(void);
{ int, int, int} MultipleReturnValueFunction(void); // if prefixed with "extern" causes syntax error
...
User avatar
ers35
Active Member
Posts: 62
Joined: Mon Jun 10, 2013 2:14 pm

Post by ers35 »

Why use extern in a function declaration? I suggest removing the extern. See http://stackoverflow.com/a/856863

Moving the extern after the multiple return compiles:

Code: Select all

// xcc -c extern-function.xc

{int, int, int} extern foo();
henk
Verified
Respected Member
Posts: 347
Joined: Wed Jan 27, 2016 5:21 pm

Post by henk »

Thanks for raising this - I have put it in the bug tracker.

The workaround is simple (just omit it), but for completeness this ought to pass without syntax error.