MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / main

Function main

test/extern-use/Main.cpp:25–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23}
24
25int main(int argc, char **argv)
26{
27 MyStruct *myStruct = new MyStruct();
28
29
30 if (!checkAttachNone("before creation"))
31 return -1;
32
33 {
34 hx::NativeAttach autoAttach;
35 const char *err = hx::Init(false);
36 if (err)
37 {
38 printf("Could not initialize library: %s\n", err);
39 return -1;
40 }
41 }
42
43
44 if (!checkAttachNone("after init"))
45 return -1;
46
47 {
48 hx::NativeAttach autoAttach;
49
50 api::HaxeObject *obj = api::HaxeApi::createBase();
51 obj->setName("child");
52
53 myStruct->haxeRef = obj;
54 obj->setName("Name");
55
56 api::HaxeObject *child = obj->createChild();
57 }
58
59
60 if (!checkAttachNone("after interaction"))
61 return -1;
62
63 {
64 hx::NativeAttach autoAttach;
65 __hxcpp_collect(true);
66 }
67
68 if (!checkAttachNone("after collect"))
69 return -1;
70
71 {
72 hx::NativeAttach autoAttach;
73 if (myStruct->haxeRef->getName()!="Name")
74 {
75 printf("Could not get value back (%s)\n", myStruct->haxeRef->getName().c_str() );
76 return -1;
77 }
78 }
79
80 {
81 hx::NativeAttach autoAttach0;
82 hx::NativeAttach autoAttach1;

Callers

nothing calls this directly

Calls 7

checkAttachNoneFunction · 0.85
InitFunction · 0.85
__hxcpp_collectFunction · 0.85
GcGetThreadAttachedCountFunction · 0.85
c_strMethod · 0.80
setNameMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected