How can I correctly assign a value to a Win32 LPCWSTR value?
import win "core:sys/windows"
create_window :: proc() -> Window {
using win
...
class_name := L("My Window")
wc := WNDCLASSEXW {
lpszClassName = class_name,
}
...
Generates the following error:
D:/Repos/demo/code/window.odin(22:19) Error: Cannot assign value 'class_name' of type '[^]u16' to 'cstring16' in a structure literal
lpszClassName = class_name,
^~~~~~~~~^
I used an example from Karl’s Odin Book and also his GitHub repo, which shows this syntax. The WNDCLASSW and WNDCLASSEXW are slightly different structs, but the type of lpszClassName is the same.
I don’t know if something has changed between Odin versions that would impact this. I’m on:
odin version
odin version dev-2025-11-nightly:e5153a9
(It says nightly, but it’s from the main release page on GitHub.
The AI suggested a fixed array of characters, but that doesn’t sound like a great solution.
How should I be doing this?