Passing Strings to a DLL

Blitz3D Forums/Blitz3D Userlibs/Passing Strings to a DLL

KuRiX(Posted 2005) [#1]
Hello. A new problem in my dll life. I need to pass a string to a dll function.

The problem is that Blitz converts the string to a C null terminated string: ("BLABLABLA" + '\0')

Then, if the string i need to pass to Blitz is not for "only message text" (containing for examples compressed floats) if the string contains any '\0' character the string will be truncated...

For example: I pass "HELLO\0WORLD" and i get only "HELLO". The same problem occurs when getting a string from a DLL.

Any help on this?


Seldon(Posted 2005) [#2]
A string in C is simply a buffer with a 0 as last byte. Only C string commands will consider that last byte. You should use a bank in Blitz, fill it as you want and pass its pointer (i.e. by reference) and eventually its length to your DLL. If you need your DLL being able to modify the buffer you pass, you should use a bank in Blitz, not a string.


KuRiX(Posted 2005) [#3]
Thanks for the answer. I thought that banks should do the job, but the banks functions are slower...