ports in structs?

Technical questions regarding the XTC tools and programming with XMOS.
kamaji
New User
Posts: 3
Joined: Wed Mar 17, 2010 1:55 pm

ports in structs?

Post by kamaji »

Is it possible to put a port inside a struct? I have tried something similar to this:

Code: Select all

struct config {
  in port din;
  out port dout;
};
but when i try to pass it to a function, it complains ""Parameter 'mystruct' is not a reference type and contains a resource"

Any tips?


User avatar
f_petrini
Active Member
Posts: 43
Joined: Fri Dec 11, 2009 8:20 am

Post by f_petrini »

From the error message I'm assuming you are not passing the argument as reference?
Try adding a "&" to the argument like this: void whatever(config& mystruct)

I'm using ports in structs and have no problems when passing the parameter as reference.
kamaji
New User
Posts: 3
Joined: Wed Mar 17, 2010 1:55 pm

Post by kamaji »

Oh okay, I didn't realise XC had references... I guess I should have inferred that from the error message though...
Thanks!