-
Notifications
You must be signed in to change notification settings - Fork 66
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
calling a private destructor of class #289
Comments
Using CxxWrap 0.11.2 (and Julia 1.6), I just hit a similar obstacle, wrapping a class like: class CTlFactory
{
public:
static CTlFactory& GetInstance();
private:
CTlFactory( void );
CTlFactory& operator=( const CTlFactory& );
CTlFactory( const CTlFactory& );
virtual ~CTlFactory(void);
}; with JLCXX_MODULE define_pylon_wrapper(jlcxx::Module& module)
{
module.add_type<CTlFactory>("TlFactory");
} complaining:
@barche Is it possible to avoid adding the finalizer for the type? Is the solution here to use |
Seems like it wasn't possible to just use JLCXX_MODULE define_pylon_wrapper(jlcxx::Module& module)
{
module.add_type<CInstantCamera>("InstantCamera")
.constructor(false)
.method("InstantCamera", [](void* device) // constructor for InstantCamera
{
return jlcxx::create<CInstantCamera>((IPylonDevice*)device);
});
} as it is the Related discussion: https://discourse.julialang.org/t/cxxwrap-based-wrapper-throws-error-in-running-finalizer-readonlymemoryerror/67097 |
@MFaisalZaki Maybe you can write a wrapper class for working around the private destructor in your https://spot.lrde.epita.fr/doxygen/formula_8hh_source.html But an overload for |
It turns out that we can just filter out the creation of the finalizer using the |
@barche Excellent! Thanks a lot! |
@barche I still seem to get errors when trying to wrap classes with protected or private destructors, e.g.: https://docs.nvidia.com/jetson/l4t-multimedia/CameraProvider_8h_source.html#l00065 As mentioned in JuliaInterop/libcxxwrap-julia#83 the so/dylib file is named inline void add_default_methods(Module& mod)
{
if (!std::is_same<supertype<T>, T>::value)
{
mod.method("cxxupcast", UpCast<T>::apply);
mod.last_function().set_override_module(get_cxxwrap_module());
}
mod.method("__delete", detail::finalize<T>);
mod.last_function().set_override_module(get_cxxwrap_module());
} My Manifest.toml references libcxxwrap_julia_jll version 0.8.8+1. |
Yes, this needs a new release. Is requiring Julia 1.6 a problem for you? Since that is the plan for the subsequent releases, notably to avoid this difference in version between the libcxxwrap_julia_jll and the library itself. |
No problem to require Julia 1.6. It seems like v0.9 is almost ready - anything I can do to help? |
I'm trying to wrap the spot library for LTL using CxxWrap and I get this warning when trying to define the fnode type.
cpp code:
`
#include <jlcxx/jlcxx.hpp>
#include
#include
#include
#include <spot/tl/formula.hh>
#include <spot/tl/parse.hh>
#include <spot/tl/print.hh>
#include <spot/tl/apcollect.hh>
#include <spot/twa/formula2bdd.hh>
#include <spot/twa/acc.hh>
#include <spot/twaalgos/translate.hh>
#include <spot/twaalgos/dot.hh>
#include <spot/twaalgos/isdet.hh>
#include <spot/twaalgos/split.hh>
#include <spot/twaalgos/totgba.hh>
// std::cout << spot::parse_formula("[]<>p0 || <>[]p1") << '\n';
// spot::formula f = spot::parse_formula("& & G p0 p1 p2");
JLCXX_MODULE define_julia_module(jlcxx::Module& mod)
{
mod.add_typespot::fnode("fnode");
mod.method("parse_formula", &spot::parse_formula);
}
`
and when building I get this error:
The text was updated successfully, but these errors were encountered: