Skip to content

import_mangled fails with clang and std::string #59

Description

@ivan-mci

I have a plugin.so file with the following function:

namespace plugin
{
  void InitPlugin(const std::string &path)
  {
  }
}

I am trying to load the function using import_mangled. I am aware that it is experimental.

boost::dll::experimental::smart_library lib("./plugin.so");
typedef void (InitPlugin_t)(const std::string&);
auto initPlugin = boost::dll::experimental::import_mangled<InitPlugin_t>(lib, "plugin::InitPlugin");

This works fine with g++, but fails with clang. Both under Ubuntu 22.04.
plugin.so exports a function named:
plugin::InitPlugin(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)

However it looks like import_mangled under clang is looking for a function named:
plugin::InitPlugin(std::basic_string<char, std::char_traits, std::allocator > const&)
Notice that the namespace __cxx11 is missing.

It seems to come from a difference between how __PRETTY_FUNCTION__ is implemented in g++ and clang.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedmanglingRelated to mangled import. Probably won't be fixed without a PR

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions