# CxxWrap and finalizers for specific instances

**URL:** <https://discourse.julialang.org/t/cxxwrap-and-finalizers-for-specific-instances/96254>\
**Category:** General Usage\
**Tags:** cxxwrap\
**Created:** [March 17, 2023, 5:06pm UTC](https://discourse.julialang.org/t/cxxwrap-and-finalizers-for-specific-instances/96254 "2023-03-17T17:06:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![peremato](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/peremato/32/29128_2.png) [@peremato](https://discourse.julialang.org/u/peremato)\
**Post date:** [March 17, 2023, 5:06pm UTC](https://discourse.julialang.org/t/cxxwrap-and-finalizers-for-specific-instances/96254/1 "2023-03-17T17:06:02Z")

</div>

I am using [CxxWrap.jl](https://github.com/JuliaInterop/CxxWrap.jl) and need to relinquish ownership for some particular instances, but not all, which is transferred to some other objects. CxxWrap has the possibility to disable the `finalizer` by adding the argument `false` to the class constructor wrapper. However this affects all objects for that class. The question is, whether there is a way to overwrite the finalizer for specific objects. I tried to define a dummy finalizer `finalizer((x)->nothing, o)` for them but it seems that the original `finalizer` defined by CxxWrap survives.
