<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Add compile-time mangler of C++ types, extern functions"
   href="http://llvm.org/bugs/show_bug.cgi?id=21263">21263</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Add compile-time mangler of C++ types, extern functions
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Modules
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>s_bugzilla@nedprod.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>It would be really nice if one could inspect a DLL or shared object for things
to load in a type safe way which catches ABI mismatching. To that end, if clang
provided a facility for getting the mangled equivalent of C++ types and extern
function declarations such that one could feed that mangled representation to
dlsym() or GetProcAddress() that would be very useful.

As an example, I'd like this to work:

namespace a { namespace b { extern std::pair<int, double>
hello(boost::variant<int, double>); } }

static const char hello_mangled=__DECORATED__(a::b::hello);

This would also work though:

static const char pair_mangled=__DECORATED__(std::pair<int, double>);
static const char hello_signature_mangled=__DECORATED__(&a::b::hello); //
mangles a std::pair<int, double>(boost::variant<int, double>) callable type

It would also be super nice if __DECORATED__() with no arguments could be used
as a magic macro like __FUNCDNAME__ can on MSVC:

void foo(int)
{
  __DECORATED__() == whatever the current function's mangled symbol is,
equivalent to __FUNCDNAME__ when building against the MSVC ABI
}

Note that one can get most of the way there already using
std::type_info::name() in unholy ways e.g. by instantiating a shim type closely
resembling the extern function, and then running regex transformations on the
mangling to yield what is probably the exported function mangling. One would
rather something less brittle however. As the compiler already knows the
mangling for types and extern things, making this available at compile time
ought to be trivial. And useful.

Niall</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>