Pretty much what the topic asks.
I have a struct that contains 3 elements that are Pointers that point to wchar_t strings (there's also another element that's a pointer to a C string which is not a problem at all) and I'm having a hell of a time trying to retrieve them and/or convert them to a regular LCB String type. I worked out a hack to do it on macOS that seems to work quite well, but it's a total fail on Windows. I've tried tapping into various <builtin> functions found in Livecode's foundation.h header with not much success. In fact, I seem to be getting further from a solution. It's very frustrating because these are just name strings, important for humans, but not actually important to the functionality of the library I'm wrapping (HIDAPI).
Pointer to wchar_t string to String?
-
- Posts: 632
- Joined: Wed Apr 24, 2013 4:53 pm
- Contact:
Re: Pointer to wchar_t string to String?
possibly pasting some...
would help you reach faster some
..my 1 cents 1/2
Code: Select all
Hell of a code here
Code: Select all
Heavenly code here
-
- Posts: 632
- Joined: Wed Apr 24, 2013 4:53 pm
- Contact:
Re: Pointer to wchar_t string to String?
OK, I think I figured out the problem tapping into this <builtin> function
Seems like this actually does work fine on Windows, but was crashing the engine on macOS?
I'm Not 100% sure, but now I have a split if the OS is windows it uses the above, else any other OS it uses my getWCharString (which is a bit hacky, and works by pulling ANSI characters out of the character array and looking for a bunch of nulls in a row for string termination). Bottom line is it's working on both macOS & Windows now.
Here is the LCB Code if anyone is interested: https://github.com/PaulMcClernan/LCB_HI ... HIDAPI.lcb
Code: Select all
MCStringCreateWithWString(const unichar_t *wstring, MCStringRef& r_string);
I'm Not 100% sure, but now I have a split if the OS is windows it uses the above, else any other OS it uses my getWCharString (which is a bit hacky, and works by pulling ANSI characters out of the character array and looking for a bunch of nulls in a row for string termination). Bottom line is it's working on both macOS & Windows now.
Here is the LCB Code if anyone is interested: https://github.com/PaulMcClernan/LCB_HI ... HIDAPI.lcb