File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package cpp .marshal ;
2+
3+ /**
4+ * An object which has been rooted will not be collected by the GC even if it has no other references.
5+ * Rooted objects can also be used to safely pass managed objects into unmanaged code.
6+ */
7+ @:semantics (value )
8+ @:cpp.ValueType ({ namespace : [ " cpp" , " marshal" ] })
9+ extern class RootHandle {
10+ /**
11+ * Root the provided object and return a handle representing it.
12+ */
13+ public static function create (obj : Dynamic ): RootHandle ;
14+
15+ /**
16+ * Reinterpret the provided `void*` as a rooted object.
17+ * If `ptr` is not a rooted object the behaviour is undefined.
18+ */
19+ public static function fromVoidPointer (ptr : cpp. Pointer <cpp. Void >): RootHandle ;
20+
21+ /**
22+ * Unroot the object represented by this handle.
23+ * If there are no other references to the object it will be eligible for collection by the GC.
24+ */
25+ function close (): Void ;
26+
27+ /**
28+ * Return the object represented by this handle.
29+ */
30+ function getObject (): Dynamic ;
31+
32+ /**
33+ * Returns the rooted object reinterpreted as a `void*`.
34+ */
35+ function toVoidPointer (): cpp. Pointer < cpp. Void > ;
36+ }
You can’t perform that action at this time.
0 commit comments