On Wednesday, 9 December 2020 at 20:35:21 UTC, Jack wrote:
I'm on linux/opensuse, trying to pass a wchar_* from C to D but
I'm getting only the first letter of that string. Could someone
help figure out why?
[...]
May be this help to you:
auto s2 = to!string(s);
to
auto s2
On Wednesday, 9 December 2020 at 21:28:04 UTC, Paul Backus wrote:
On Wednesday, 9 December 2020 at 21:21:58 UTC, ag0aep6g wrote:
D's wchar is not C's wchar_t. D's wchar is 16 bits wide. The
width of C's wchar_t is implementation-defined. In your case
it's probably 32 bits.
In D, C's wchar_t
On Wednesday, 9 December 2020 at 21:21:58 UTC, ag0aep6g wrote:
D's wchar is not C's wchar_t. D's wchar is 16 bits wide. The
width of C's wchar_t is implementation-defined. In your case
it's probably 32 bits.
In D, C's wchar_t is available as `core.stdc.stddef.wchar_t`.
http://dpldocs.info/e
On 09.12.20 21:35, Jack wrote:
I'm on linux/opensuse, trying to pass a wchar_* from C to D but I'm
getting only the first letter of that string. Could someone help figure
out why?
this is the piece of D code:
extern(C) export
void sayHello(const (wchar) *s)
[...]
and below the piece of C cod
On Wednesday, 9 December 2020 at 20:35:21 UTC, Jack wrote:
the output is "h" rather "hello". What am I missing?
In the sayHello function, you are converting a pointer to utf16
character into utf8 string, not utf16 string to utf8 string.
Convert the C wstring to a D `wstring` first
(std.strin
I'm on linux/opensuse, trying to pass a wchar_* from C to D but
I'm getting only the first letter of that string. Could someone
help figure out why?
this is the piece of D code:
extern(C) export
void sayHello(const (wchar) *s)
{
import std.stdio : writeln;
import std.conv : to;