Buffers (Magic xpa 4.x)
A Magic xpa project is sometimes required to interact with third-party modules. This interaction may involve an exchange of information through binary collection of data commonly known as structures or more generally known as buffers.
Buffers allow you to store a lot of varied data in one variable. These are similar to Struct in C-type languages, or the User Defined Type in Visual Basic.
You will need to be familiar with type sizes as they are implemented in computer languages. For example, a Numeric value in the range of –32,768 to 32,767 or 0 to 65,575 can be stored in a numeric memory variable called "Double" and use 2 bytes of memory.
In Magic xpa, buffers are stored in the BLOB data type. Not all BLOBs are buffers however. A BLOB becomes a buffer after you use a Bufset function to move data to it. When you do this, Magic xpa initializes the BLOB with some bytes at the beginning.
By using the special Buffer management functions, it is possible to construct the required structure In addition, by using matching functions it is possible to retrieve data from a structure.
You cannot view buffers directly. However, you can use the Blb2File() function to store the buffer/BLOB to a file, where you can use a hex editor to view the exact contents.
If you need to reset a buffer, or any other BLOB, just update it to Null().
Similarly, if you need to test for an empty buffer, just compare it to Null().
You can use the Invoke UDP operation to connect to third-party DLLs as well as pass arguments and receive arguments.