class
Bindgen::CallBuilder::CrystalFromCpp
- Bindgen::CallBuilder::CrystalFromCpp
- Reference
- Object
Overview
Builder for calls made from C++ to a Crystal CrystalProc.
The Proc runs the call in BindgenHelper.rescued: an exception it
raises goes to BindgenHelper.on_exception, and a zero of the result
type returns to C++, as the exception can't unwind through C++ frames.
Defined in:
bindgen/call_builder/crystal_from_cpp.crConstructors
Instance Method Summary
-
#build(method : Parser::Method, receiver = "self", do_block = false, 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 do_block is true, the generated Proc expression will use
do ... end instead of { ... }. This allows embedding the code body
inside a string conversion template, without the code block being
interpreted as an environment variable (see also Template::Basic).
With crystal_object, for the override of a virtual method, the Proc
takes the Crystal object as its first argument instead of capturing
self, see CppToCrystalProc::CRYSTAL_OBJECT, and calls the override
on it as an instance of typeof(self), the type the Proc is built
in, which names a private type too. So the Proc captures nothing: a
closure the C++ object holds would refer to the
Crystal object, and the GC never finalizes an object reachable from
itself through another, so neither would ever be collected.