It doesn't look like a big thing, but the relevant bit of my code is this:
int intvals[3];
float floatvals[10];
int main() {
intvals[0] = 17;
intvals[1] = 19;
floatvals[0] = 3.14;
floatvals[1] = 1.5;
Here, I'm allocating two arrays in global space, assigning to them (and then reading from them, not pictured in the code snippet here).
A couple things I discovered along the way, which isn't well documented in the stuff I was looking at, was that array allocations need to have their "linkage" specified, which I haven't been doing for other global variables. Also, I wasn't able to get things working until I provided initializers for my arrays. That's a good thing, and I was considering providing default initialization anyway. I found it surprising that the LLVM assembler didn't want to accept my generated bytecode until I provided initialization values for my arrays.
Next up:
- arrays declared locally (top of function, inside loops)
- arrays of structs (e.g. Vec2f, Ship)
- *GL linkage, passing arrays through to OpenGL and WebGL
No comments:
Post a Comment