Thread overview
[Issue 21203] Accept pragma(mangle) on aggregate types
Aug 27, 2020
Manu
Aug 27, 2020
Manu
Sep 29, 2020
Andrej Mitrovic
Sep 29, 2020
Manu
Oct 05, 2020
Nicholas Wilson
Nov 10, 2020
Dlang Bot
Mar 24, 2021
Dlang Bot
August 27, 2020
https://issues.dlang.org/show_bug.cgi?id=21203

--- Comment #1 from Manu <turkeyman@gmail.com> ---
Sorry, that should read:

template ScopeClass(C)
{
  ...
}

!!

--
August 27, 2020
https://issues.dlang.org/show_bug.cgi?id=21203

--- Comment #2 from Manu <turkeyman@gmail.com> ---
And I missed the most important one:

void fun(const(ScopedClass!MyClass)*);     // mangles const MyClass*

That's the money shot!

(I wish you could edit in bugzilla!!!)

--
September 29, 2020
https://issues.dlang.org/show_bug.cgi?id=21203

Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com

--- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> ---
+1

Also we currently cannot add a binding to std::function. Because function is a keyword. And pragma(mangle) doesn't work on structs.

--
September 29, 2020
https://issues.dlang.org/show_bug.cgi?id=21203

--- Comment #4 from Manu <turkeyman@gmail.com> ---
I think this is a really big deal! It'll enable in-language solutions for a
whole heap of our biggest extern(C++) problems...
I'm surprised it's not receiving more attention.

--
October 05, 2020
https://issues.dlang.org/show_bug.cgi?id=21203

Nicholas Wilson <iamthewilsonator@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |iamthewilsonator@hotmail.co
                   |                            |m

--- Comment #5 from Nicholas Wilson <iamthewilsonator@hotmail.com> ---
Runnable example:

template ScopeClass(C)
//  if (is(C == class))
{
  static if (__traits(getLinkage, C) == "C++")
  {
    extern(C++, class)
    pragma(mangle, C.mangleof) // <- here's the magic!
    struct ScopeClass
    {
      char[__traits(classInstanceSize, C)] buffer;

      //... all the things ...
    }
  }
}
extern(C++):
class MyClass {}
void funa(MyClass);                      // mangles MyClass*
void funb(const MyClass);                // mangles const MyClass* const
void func(ScopeClass!MyClass);           // mangles MyClass
void fund(const ScopeClass!MyClass);     // mangles const MyClass
void fune(ref ScopeClass!MyClass);       // mangles MyClass&
void funf(ref const ScopeClass!MyClass); // mangles const MyClass&
void fung(const(ScopeClass!MyClass)*);
//                            currently prints
pragma(msg,funa.mangleof); // _Z4funaP7MyClass
pragma(msg,funb.mangleof); // _Z4funbPK7MyClass
pragma(msg,func.mangleof); // _Z4func10ScopeClassIP7MyClassE
pragma(msg,fund.mangleof); // _Z4fund10ScopeClassIP7MyClassE
pragma(msg,fune.mangleof); // _Z4funeR10ScopeClassIP7MyClassE
pragma(msg,funf.mangleof); // _Z4funfRK10ScopeClassIP7MyClassE
pragma(msg,fung.mangleof); // _Z4fungPK10ScopeClassIP7MyClassE

--
November 10, 2020
https://issues.dlang.org/show_bug.cgi?id=21203

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
@thewilsonator updated dlang/dmd pull request #11835 "Fix issue 21203: Accept pragma(mangle) on aggregate types" fixing this issue:

- Fix issue 21203: Accept pragma(mangle) on aggregate types

https://github.com/dlang/dmd/pull/11835

--
March 24, 2021
https://issues.dlang.org/show_bug.cgi?id=21203

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #11835 "Fix issue 21203: Accept pragma(mangle) on aggregate types" was merged into master:

- 49a184cc6d619dbc6b6bb7e7393e0181171de659 by Nicholas Lindsay Wilson:
  Fix issue 21203: Accept pragma(mangle) on aggregate types

https://github.com/dlang/dmd/pull/11835

--