On Wednesday, 27 July 2022 at 12:26:59 UTC, MyNameHere wrote:
```d
void Main(void* Instance)
{
    WNDCLASSEXA WindowClass;
```

This is equivalent to `WNDCLASSEXA WindowClass = WNDCLASSEXA.init;`

If the struct's fields all initialize to 0, the compiler would simply set the variable's bytes to 0, but the definition in druntime gives fields with non-zero default value:

```D
struct WNDCLASSEXA {
    UINT      cbSize = WNDCLASSEXA.sizeof; // <-- non zero init
    UINT      style;
    WNDPROC   lpfnWndProc;
    int       cbClsExtra;
    int       cbWndExtra;
    HINSTANCE hInstance;
    HICON     hIcon;
    HCURSOR   hCursor;
    HBRUSH    hbrBackground;
    LPCSTR    lpszMenuName;
    LPCSTR    lpszClassName;
    HICON     hIconSm;
}
```

Because of this, the compiler defines an 'init symbol' in druntime that gets copied into your variable to initialize it. Because druntime isn't linked when using BetterC, the linker fails to find the init symbol.

I think removing the default initialization will fix it:
```D
WNDCLASSEXA WindowClass = void;
```

Reply via email to