class

Bindgen::CallBuilder::CppToCrystalProc

Inherits Reference < Object

Builder for calls made from C++ to Crystal. Used for callbacks, Qt signals and virtual method overrides.

Constants

CRYSTAL_OBJECT = "_crystal_"

Name of the local holding the Crystal object of the C++ object, in the C++ virtual method and in the Proc of its Crystal override, see #build and CrystalFromCpp#build.

CRYSTAL_OBJECT_TYPE = Parser::Type.parse("void", 1)

Its type, void *.

Constructors

new(db : TypeDatabase)
Source

Instance methods

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. 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.

Source

Nested types