| Home | Libraries | People | FAQ | More

## Function symbol_location

boost::dll::symbol_location

## Synopsis

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

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

## 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: |

`ec` | Variable that will be set to the result of the operation.
`symbol` | Symbol which location is to be determined.

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::system::error_code also throws boost::system::system_error.