No pointers in XC - but function pointers?

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
Interactive_Matter
XCore Addict
Posts: 216
Joined: Wed Feb 10, 2010 10:26 am

No pointers in XC - but function pointers?

Post by Interactive_Matter »

Hi,

I got a lot of problems merging C and XC code:

C uses pointer very extensively - how can I map a XC variable to a C pointer - by arrays?
char* becomes char[]?

Is there a way to use function pointers in XC?
I know that there are threads and channels but I would like to reuse some C code with function pointers more or less unchanged?

Thanks

Marcus


User avatar
paul
XCore Addict
Posts: 169
Joined: Fri Jan 08, 2010 12:13 am

Post by paul »

You can use pointers between C/XC by passing stuff using references (&var etc), and for arrays like you have describe above. XC doesn't do function pointers - so you probably need to create a C wrapper to call the function pointer to get access to them.
Paul

On two occasions I have been asked, 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.