www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20012] New: export inside mixin doesn't seem to work

https://issues.dlang.org/show_bug.cgi?id=20012

          Issue ID: 20012
           Summary: export inside mixin doesn't seem to work
           Product: D
           Version: D2
          Hardware: All
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: turkeyman gmail.com

This works:

export extern(C) void fun() {}

Build as a DLL, fun is correctly exported. You can get "fun" with
GetProcAddress.

This doesn't work:

mixin template M()
{
  export extern(C) void fun() {}
}
mixin M!();

When I do this, "fun" is just not exported and GetProcAddress fails.

What's very strange is, the library feature SimpleDllMain in
core.sys.windows.dll to mixin the DllMain function DOES seem to work, and
looking at the source, it's not even declared `export`... so maybe there's just
some special handling for the DllMain symbol?

--
Jun 29 2019