[Issue 11910] New: Writes to extern (C) struct have no effect

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jan 12 19:08:29 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=11910

           Summary: Writes to extern (C) struct have no effect
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: turkeyman at gmail.com


--- Comment #0 from Manu <turkeyman at gmail.com> 2014-01-12 19:08:24 PST ---
Is this bad codegen, or have I done something wrong?

extern (C) struct MFDefaults
{
    extern (C) struct InputDefaults
    {
        bool allowMultipleMice;
        bool mouseZeroIsSystemMouse;
        bool systemMouseUseWindowsCursor;
        bool useDirectInputKeyboard;
        bool useXInput;
    }

    InputDefaults input;
}

extern (C) __gshared MFDefaults gDefaults;

void f()
{
  gDefaults.input.useXInput = false; // assignment has no effect
}


This code builds and links successfully. In the debugger I can inspect the
values of the struct and they are correct, consistent with the struct in the C
code.
But when I assign to anything, it simply has no effect...

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list