<glances at IanM>
I'm running Upgrade 6.6b - had to in order to make Wolf's Animation plugin work. Or was this fixed just recently? I'll go check to see if this is, indeed, the latest version. 21st of March, 2007 appears to be "the one"...
You also need to define your array properly by running the dim command - it's not enough to simply have it in your source code somewhere.
<frustration mounts, head explodes>
Okay, I'll bite: when *do* these little things happen? I'm not too clear on it for DBPro, which seems capricious at best. In C++, you define your arrays/variables/constants
first, then
use them. In DBPro, you define/use your arrays/variables/constants whenever? Or maybe you should define them all in the head of the initial file, in the hopes that the compiler perhaps will see them and grant them some small space on the far heap?
Make some sense of this: when I use the direct array approach:
+ Code Snippet INC chunkLen, 1
DIM chunkData(chunkLen)
chunkData(chunkLen) = aggChunkVal
...the code
works! And if I do it using QUEUES, it
fails. So, I'm to understand that the variable definitions that are included in another file,
GLOBAL in scope though they be, are useless? Heh, maybe
Dijkstra was onto something when he said what he said about BASIC programming.
Perhaps I spent too much time coding in C/C++ to make sense of this, so can somebody tell me the order of compilation? It is all too clear to me now what is happening: the compiler has
absolutely no clue where anything is, or what the
scope of it
might be - there is no structure for it to follow - so for some unknown reason the compiler does not touch the included structure file until it reaches a #CONSTANT that it does not understand. Up until then, it "makes it up" as it goes along. Can't find the instantiation of the ARRAY of chunkData? Make it up (instantiate it) on the spot - making that array local to the FUNCTION! Then, after returning from the function, the *rest* of the application is left in the dark. Dark. BASIC. Fitting.





!!
<snickers at self> <snickers again at self>
I've written a few compilers in my time. I wonder why I missed *
that*, it was staring me (quite literally) in the face. I must be slipping...
<wipes face with hand, inhales deeply>
<cools down, gets a grip, and becomes normal again>
<...well whatever passes for normal - with LongFist, you never know...>

I'm sorry - this is my official apology for sending you guys running round and round trying to figure this thing out. Here. I'll spell it out for you, because I must admit that I'm not making too much sense.
The compiler arrives at the FUNCTION ReadChunkData(), and plunges in. Now, it doesn't matter that - in another file - there is a GLOBAL definition for 'chunkData' as a DWORD. (Which makes me wonder how in the world it treats other GLOBAL definitions in the program.) It just rolls right in there, and encounters the statement "ADD TO QUEUE chunkData()" and tries to figure out what
I mean by that. I no longer assume it checks a resource hash to determine if such a thing exists: it apparently creates a local array called "chunkData" of what type I can only imagine, the default probably being INTEGER unless I miss my guess. It then goes through the motions, adding data, adding data, etc. Then, the FUNCTION ends, and all LOCAL data is removed from the stack - the impromptu chunkData array along with it. The instruction pointer returns to the main segment of the program, and when the array is accessed - since it wasn't really played with at all - a fatal exception is generated, because the program has attempted to read data that isn't there. In fact, the pointer to that array hasn't even been instantiated yet, so it points to some default location "0xfffffff4" or other. Regardless, the app crashes, spits up a "send/don't send" dialog for Windows, and dies.
But get this: if I use the DIRECT array manipulators, NOT the QUEUE commands, the compiler acts in a different way. Somehow, by using the DIM command to resize the array, the compiler mystically becomes aware that - one file over - there is a GLOBAL definition for that very same ARRAY, and everything works perfectly, right down to being able to access the data --- inserted into the Array within the FUNCTION --- as the GLOBAL data that it is.
<...can anybody see where an experienced developer might be frustrated?>
I was confused, but now I am not. If you intend to use structured, methodological development styles (like are employed in C, C++, Pascal, Java, etc.) with DBPro, you're in for a LONG, LONG road. A long, and possibly frustrating journey, I'm afraid. But at least
now I think I understand, and this might make me even
more useful to others in the future... ...after all, there is no knowledge that is not power...


Thank you guys for your time and patience. I'm sorry if I managed to upset anyone - that was never my intention. My frustration was just getting the better of me, that's all. And as a businessperson, you'd think I had better self control, now wouldn't you? For shame. Please accept my apologies. Thank you for your time and consideration. I will rant no more.
