Core Function DllStructGetVars
From Sputnik Wiki
DllStructGetVars( <dllstruct> )
Contents |
Description
Create an array of all items and their array size with total byte size
Parameters
dllstruct
The DLLStruct to use.
Return Value
Success - Returns the array (hashmap name,key) with keys as the variable names with value as a 3 element array where first is the ubound of the array and second is total bytes used by the item and the third is the name of the struct that the item is an object of if this name is an empty string then the item is not a struct.
Failure - Returns empty array.
Remarks
If you get 0 on the array size it means its not an array!.
Example
$a = DllStructCreate( "int var1;ubyte var2;int test[700];uint var3;char var4[128]"); $vlist = DLLStructGetVars($a); foreach($vlist as $Name => $vData) { List( $UBound, $Bytes, $StructName ) = $vData; if($UBound) println("DLLStruct item '$Name' has array size of '$UBound' and uses '$Bytes' byte(s) of ram"); else println("DLLStruct item '$Name' is not an array and uses '$Bytes' byte(s) of ram"); } // A more cool way println("DLLStruct item 'test' has UBound of '" . DLLStructGetVars($a)["test"][0] . "'"); println("DLLStruct item 'test' uses '" . DLLStructGetVars($a)["test"][1] . "' byte(s) of ram");