RESOURCES
Use arrays in CODE resources
This is an open request for anyone who can help. The problem is that the FB compiler won't allow arrays in a WDEF code resource that I'm writing.
It turns out that the snippet below compiles properly without the RESOURCES statement, but as soon as I put the RESOURCES statement back in, I get the array error message. Here is a code snippet. (By the way, you don't need to have the resource file available to see the error message. If anyone needs the file, you can use a copy of the "Windoid WDEF.rsrc" file in the "WDEF Folder" inside the Examples folder.)
My WDEF's structure is copied from the WDEF that is supplied with FB. Thus the LONG FN and the use of a "global".
RESOURCES "","rsrcRSED","WDEF",4,"MyWindow"
COMPILE 0,_macsBugLabels_appendRes_dimmedVarsOnly
OUTPUT FILE "TestArray.rsrc"
DIM gTest&(10)
"Main"
LONG FN TestArray
gTest&(1)=0
END FN
FN TestArray
Right. There's no way to do it. You'll have to create and manage an array some other way.
For example, you could create a pointer block and use accessor functions:
DIM gTestPtr&
_gTestSize = 4
LOCAL FN InitGTest
gTestPtr& = FN NEWPTR(11 * _gTestSize) '11 elements, 4 bytes per element
END FN
LOCAL FN GetGTest(item%)
END FN = [gTestPtr& + (item% * _gTestSize)]
LOCAL FN SetGTest(item%, value&)
& gTestPtr& + (item% * _gTestSize), value&
END FN
|