class
Bindgen::CallBuilder::CppToCrystalProc
- Bindgen::CallBuilder::CppToCrystalProc
- Reference
- Object
Overview
Builder for calls made from C++ to Crystal. Used for callbacks, Qt signals and virtual method overrides.
Defined in:
bindgen/call_builder/cpp_to_crystal_proc.crConstant Summary
-
CRYSTAL_OBJECT =
"_crystal_" -
Name of the local holding the Crystal object of the C++ object, in the C++ virtual method and in the
Procof its Crystal override, see#buildandCrystalFromCpp#build. -
CRYSTAL_OBJECT_TYPE =
Parser::Type.parse("void", 1) -
Its type,
void *.
Constructors
Instance Method Summary
-
#build(method : Parser::Method, *, proc_name : String = "_proc_", lambda = false, capture : String | Nil = nil, crystal_object = false) : Call
Calls the method, using the proc_name to call-through to Crystal.
Constructor Detail
Instance Method Detail
Calls the method, using the proc_name to call-through to Crystal.
If lambda is true, instead of invoking the method, builds a C++
lambda expression that wraps the invocation, capturing proc_name by
value, or the capture given instead, like proc = hold(f).
With crystal_object, the CrystalProc of a virtual method override
takes the Crystal object of the C++ object as its first argument, the
local _crystal_ of CppMethod::VirtualBody, see CRYSTAL_OBJECT:
the Proc captures nothing, so the C++ object doesn't refer to the
Crystal object, which would keep both from being collected.