-
Notifications
You must be signed in to change notification settings - Fork 74
Open
Description
Hello
I have a project to wrap the high-energy physics library HepMC3, where CxxWrap has an issue when there are two functions, where one takes vector of shared pointers to T and the other a vector of shared pointers to const T.
A minimum reproducer is:
#include "jlcxx/jlcxx.hpp"
#include "jlcxx/stl.hpp"
#include <memory>
#include <vector>
void g(std::vector<std::shared_ptr<int>> v){}
void h(std::vector<std::shared_ptr<const int>> w){}
JLCXX_MODULE define_julia_module(jlcxx::Module& types){
types.method("g", g);
types.method("h", h);
}A library built to wrap these functions will fail to load with the error:
ERROR: LoadError: Double registration for method (:constructor, :StdVector, :dr, 0xa0c245c5f9fa2716)This doesn't happen with bare pointers, but unfortunately the library I am wrapping makes heavy used of shared_ptr and it's a blocker for us not to have the two versions supported.
Thanks in advance for any fixes or suggestions (and thanks to @grasph for helping track this down).
P.S. The actual library code causing the issue is found in cases like this:
std::vector<GenParticlePtr> parents();defined herestd::vector<ConstGenParticlePtr> parents() const;defined here
where GenParticlePtr and ConstGenParticlePtr types are:
using GenParticlePtr = std::shared_ptr<GenParticle>;
using ConstGenParticlePtr = std::shared_ptr<const GenParticle>;as defined here.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels