« Real Studio Developer… | Home | MBS Filemaker Plugin,… »

Expected 64 bit issues

We are preparing plugins for 64 bit target coming to Real Studio later this year. So we move a lot of integer parameters and properties to use RBInteger data type in C. This one is 32 bit or 64 bit depending on the target bit size. Also for other integer types we specify them more exact. Not simply unsigned int, but UInt32 or UInt64. For color values we no longer use integers, but RBColor in C which is a 32 bit unsigned integer in all cases.

Now for real 64 bit we have to check every integer in the plugin code. You also need to check your code and make it save for the future. For example how much code do you have like this:

dim n as integer = len(SomeString)

This will work as integer goes to 64 bit and a 5 GB string would not cause problems.

Good things happen as code like this will fix:

dim FileSize as integer = SomeFolderitem.Length

If the file is 3 GB big, this will give you a bad value in 32 bit target, but will be correct in 64 bit target. Still code like this is dangerous:

dim data as string = myBinaryStream.Read(myBinaryStream.length)

If you select a 10 GB file, in 32 bit this will return an empty string as the buffer can't be allocated, but on 64 bit target, the system will try to launch it and swapping virtual memory will block the computer for a few minutes.

Another thing is use of Memoryblocks and Ptrs. There will be a lot of code where we and you need to update the code to have different integer sizes. Also structures will change. You may even need to write Structures two times if one has UInt32 and one UInt64 as Real Studio has no general unsigned integer type.

In C we will have more issues. Starting from string functions which still work with 32 bit sizes to casting of pointers to integers and back loosing a few bits. Also bit operations like BitwiseXor, BitwiseShift or BitwiseNot may give you more bits than you may expect. Good luck for all of us!
27 01 13 - 23:40