vdweller
Member
Hi all!
I am working on a C++ dll's ability to return a char array.
My first question is: The template specifies a return type of char pointer . Is there a problem if the function returns an unsigned char pointer? I did some tests and it seems like it has no problem, but maybe it won't be OK for other machines, or am I missing some other important detail?
Now, let's assume I want the C++ dll to return an array of 64-bit integer elements. Let's not dispute the "why" for a moment.
One way I tested and found (so far) working is, in C++, breaking down the 64-bit value into 8 8-bit (char) chunks and putting each one into the char array in sequence. When done, the "string" is returned to GM.
Then, in GameMaker, by performing a buffer_read(buffer,buffer_u64), the value seems to be OK.
My second question is: Is this way OK/safe? Is there a better way to do this? Are there any details I should keep in mind (endianness? something else?)
I am working on a C++ dll's ability to return a char array.
My first question is: The template specifies a return type of char pointer . Is there a problem if the function returns an unsigned char pointer? I did some tests and it seems like it has no problem, but maybe it won't be OK for other machines, or am I missing some other important detail?
Now, let's assume I want the C++ dll to return an array of 64-bit integer elements. Let's not dispute the "why" for a moment.
One way I tested and found (so far) working is, in C++, breaking down the 64-bit value into 8 8-bit (char) chunks and putting each one into the char array in sequence. When done, the "string" is returned to GM.
Then, in GameMaker, by performing a buffer_read(buffer,buffer_u64), the value seems to be OK.
My second question is: Is this way OK/safe? Is there a better way to do this? Are there any details I should keep in mind (endianness? something else?)