Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Macro BOOST_DLL_ALIAS

BOOST_DLL_ALIAS — Makes an alias name for exported function or variable.

Synopsis

// In header: <boost/dll/alias.hpp>

BOOST_DLL_ALIAS(FunctionOrVar, AliasName)

Description

This macro is useful in cases of long mangled C++ names. For example some void boost::foo(std::string) function name will change to something like N5boostN3foosE after mangling. Importing function by N5boostN3foosE name does not looks user friendly, especially assuming the fact that different compilers have different mangling schemes. AliasName is the name that won't be mangled and can be used as a portable import name.

Can be used in any namespace, including global. FunctionOrVar must be fully qualified, so that address of it could be taken. Multiple different aliases for a single variable/function are allowed.

Make sure that AliasNames are unique per library/executable. Functions or variables in global namespace must not have names same as AliasNames.

Same AliasName in different translation units must point to the same FunctionOrVar.

Puts all the aliases into the "boostdll" read only section of the binary. Equal to BOOST_DLL_ALIAS_SECTIONED(FunctionOrVar, AliasName, boostdll).

Example:

namespace foo {
  void bar(std::string&);

  BOOST_DLL_ALIAS(foo::bar, foo_bar)
}

BOOST_DLL_ALIAS(foo::bar, foo_bar_another_alias_name)

See: BOOST_DLL_ALIAS_SECTIONED for making alias in a specific section.

Parameters:

AliasName

Name of the alias. Must be a valid C identifier.

FunctionOrVar

Function or variable for which an alias must be made.


PrevUpHomeNext