The compile-results box shows the same error for all of the similar function prototypes in my header file "custom_types.h". This led me to believe that I couldn't pass structures by reference, but I made another sketch in which I passed structures (and structures in structures) by reference and it compiled with no problems.

Here's an excerpt from "custom_types.h", so you can see if I'm doing something obviously wrong:

I'd be very grateful for some hints on what to try next, or what other info I can provide. For the record, I do include "custom_types.h" in several files, including the main sketch file. I also include "WProgram.h" in "custom_types.h" so I can have access to certain constants like HIGH and LOW.

Thanks again for the help!!! I really appreciate the reminders to check the obvious stuff. I'm starting to worry that this is a more subtle bug related to the automatic code generation, or something being built out of place.

void render(Matrix *matrix){/*Similar to how a video game separates logic and rendering,We'll calculate the matrix state and apply PWM effectsbefore pushing out whether the pins are high or low. We even track which chans are 'dirty.'

Passing by reference for speed, not sure if that reallyneeds to be done, but I figured it was a couple hundred bytesper cycle that don't need to be copied :p*/ for (int i=0; i < matrix->width; i++) { if (matrix->chan[i]->dirty) { digitalWrite(matrix->chan[i]->pin, matrix->chan[i]->state); } }}

I don't have your hardware, so I have no idea if this executes properly, but it does compile and link.

Thank you guys so much for the extensive help. PaulS, that was really nice of you to go so far.

It seems C doesn't quite like passing structs around by reference, but I know it's perfectly sensible in C++. I wonder: If a function accepts a struct where the argument should be a struct pointer, does this mean that structs are actually just pointers (like arrays?), and member access is just shorthand for pointer arithmetic?

I don't have the hardware either, it's still in the mail. But getting it compiled takes a huge worry off my shoulders. Thanks so much.

Now that I've gotten it to compile, I wanted to reply with some interesting things I found out. Basically, all I had to do was change the file extension from .c to .cpp, and the compiler no longer complained about passing structs by reference.

There were a host of other errors to track down, mainly caused by using non-constant extern globals. Which is just as well, because I shouldn't be using non-constant globals anyway:) Global vars declared const worked fine. Just wanted to warn you that thar be dragons that way.