Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import_mangled fails with clang and std::string #59

Open
ivan-mci opened this issue Feb 5, 2023 · 0 comments
Open

import_mangled fails with clang and std::string #59

ivan-mci opened this issue Feb 5, 2023 · 0 comments

Comments

@ivan-mci
Copy link

ivan-mci commented Feb 5, 2023

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.

Firefly35 pushed a commit to Firefly35/dll that referenced this issue Jul 11, 2023
…dle-fix

fix path_from_handle implementation on Windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant