On 4 Oct 2014 at 12:41, Andrey Semashev wrote:
I think any such technique is non-portable since there is no portable way to obtain mangled name of a function in compile time.
Who cares.
I do, obviously.
The library abstracts a whole ton of non-portable stuff around DLLs. Mangling is just another one of those.
All the major compilers do provide this, and a large number of the minor ones. When myself and Antony surveyed the situation during TypeIndex we were pleasantly surprised at just how widespread support is for some magic macro which expands to the mangled form of the enclosing function. Mangling schemes have also basically reduced to just two kinds in recent compilers, with the Microsoft mangling scheme considerably the harder to parse. Mangling schemes are also very stable over time. That makes this proposal tractable.
We had a similar discussion already. IMO, the library in its core should not rely on compiler specific features and should be implementable in pure C++ and standard APIs. This ensures its portability. It doesn't matter how many compilers implement the extension because there will always be the one that doesn't.
Andrey, please list here three C++ compilers which had at least one version release in the past five years which doesn't provide a magic macro expanding out to the mangling of the enclosing function.
In any case, I don't think that mangled names are useful for other reasons I mentioned.
With such support, the following:
plugin = dll::import_variable_alias