title: Boost Python issue with converters - static linking
body: <p>I have a question regarding the below code.</p>
  <p>It's an example how to pass a custom class via shared_ptr to embedded python code and it works when boost is dynamically linked.</p>
  <p>Unfortunately the same code with statically linked boost doesn't work with the following error message:</p>
  <p>&quot;No to_python (by-value) converter found for C++ type: class boost::shared_ptr&quot;.</p>
  <p>I don't understand why a different linking can affect type recognition of a registered converter. What am I missing?</p>
  <p>Can anybody help me out?</p>
  <p>Thanks,</p>
  <p>Dominik</p>
  <p>Example from <a href="https://stackoverflow.com/questions/8225934/exposing-a-c-class-instance-to-a-python-embedded-interpreter?noredirect=1&amp;lq=1">here</a>.</p>
  <pre><code>#include &lt;boost/shared_ptr.hpp&gt;
  #include &lt;boost/make_shared.hpp&gt;
  #include &lt;boost/python.hpp&gt;
  #include &lt;string&gt;
  #include &lt;iostream&gt;
  
  namespace bp = boost::python;
  
  struct Foo{
      Foo(){}
      Foo(std::string const&amp; s) : m_string(s){}
      void doSomething() {
          std::cout &lt;&lt; &quot;Foo:&quot; &lt;&lt; m_string &lt;&lt; std::endl;
      }
      std::string m_string;
  };
  
  typedef boost::shared_ptr&lt;Foo&gt; foo_ptr;
  
  BOOST_PYTHON_MODULE(hello)
  {
      bp::class_&lt;Foo, foo_ptr&gt;(&quot;Foo&quot;)
          .def(&quot;doSomething&quot;, &amp;Foo::doSomething)
      ;
  };
  
  int main(int argc, char **argv)
  {
      Py_Initialize();
      try {
          PyRun_SimpleString(
              &quot;a_foo = None\n&quot;
              &quot;\n&quot;
              &quot;def setup(a_foo_from_cxx):\n&quot;
              &quot;    print 'setup called with', a_foo_from_cxx\n&quot;
              &quot;    global a_foo\n&quot;
              &quot;    a_foo = a_foo_from_cxx\n&quot;
              &quot;\n&quot;
              &quot;def run():\n&quot;
              &quot;    a_foo.doSomething()\n&quot;
              &quot;\n&quot;
              &quot;print 'main module loaded'\n&quot;
          );
  
          foo_ptr a_cxx_foo = boost::make_shared&lt;Foo&gt;(&quot;c++&quot;);
  
          inithello();
          bp::object main = bp::object(bp::handle&lt;&gt;(bp::borrowed(
              PyImport_AddModule(&quot;__main__&quot;)
          )));
  
          // pass the reference to a_cxx_foo into python:
          bp::object setup_func = main.attr(&quot;setup&quot;);
          setup_func(a_cxx_foo);
  
          // now run the python 'main' function
          bp::object run_func = main.attr(&quot;run&quot;);
          run_func();
      }
      catch (bp::error_already_set) {
          PyErr_Print();
      }
  
      Py_Finalize();
  
      return 0;
  }
  </code></pre>