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 a snapshot of the master branch, built from commit 7f623cc15e.
PrevUpHomeNext

Function template symbol_location

boost::dll::symbol_location

Synopsis

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


template<typename T> 
  boost::dll::fs::path 
  symbol_location(const T & symbol, boost::dll::fs::error_code & ec);

Description

On success returns full path and name of the binary object that holds symbol.

Examples:

int var;
void foo() {}

int main() {
   dll::symbol_location(var);                     // returns program location
   dll::symbol_location(foo);                     // returns program location
   dll::symbol_location(std::cerr);               // returns location of libstdc++: "/usr/lib/x86_64-linux-gnu/libstdc++.so.6"
   dll::symbol_location(std::placeholders::_1);   // returns location of libstdc++: "/usr/lib/x86_64-linux-gnu/libstdc++.so.6"
   dll::symbol_location(std::puts);               // returns location of libc: "/lib/x86_64-linux-gnu/libc.so.6"
}

Parameters:

symbol

Symbol which location is to be determined.

ec

Variable that will be set to the result of the operation.

Template Parameters:

T

Type of the symbol, must not be explicitly specified.

Returns:

Path to the binary object that holds symbol or empty path in case error.

Throws:

std::bad_alloc in case of insufficient memory. Overload that does not accept boost::dll::fs::error_code also throws boost::dll::fs::system_error.

PrevUpHomeNext