On Wed, Jul 10, 2013 at 11:39 AM, Adam D. Ruppe <span dir="ltr"><<a href="mailto:destructionator@gmail.com" target="_blank">destructionator@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Wednesday, 10 July 2013 at 17:44:51 UTC, Timothee Cour wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
* One use case is using it in shared libraries:<br>
user asks for a symbol via its demangled string representation (which is most natural for user), then the string is mangled, and then calls dlsym to retrieve the actual pointer to symbol in the shared lib.<br>
</blockquote>
<br></div>
I think in this case, it would be better to use .mangleof anyway because you'll want that type safety. You could still compare a user inputted string to typeof(S).stringof if you want to choose one at runtime.<br></blockquote>
<div><br></div><div>How would that work, since this is runtime only? I'm interested in the case where I don't have access to said symbol, all I have is a string representation of it. For example when using dlopen on a library where we don't have source code; so in this case typeof(S) doesn't make sense.</div>
<div><br></div></div>