Prev | Current Page 1052 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"


However, if you ??™ re extending Neko using C/C++, you fall into a realm where Neko has limited control,
so it is still down to you, the developer, to manage where memory is being used, and to ensure that it
is cleaned up properly.
When storing data into a value struct for persistence, you ??™ ll probably also want to request support from
the garbage collector for that value, so that, once the value is no longer required, it can be freed safely
and efficiently. Neko provides several functions for just such a purpose.
alloc_root()
When working with event - based libraries, you will more than likely acquire the need to deal with some
form of callback to the Neko layer. This callback will fire when a particular event is raised, so, you never
know when the function will be called, only that you need to register a function to the event in advance.
Neko provides a solid way of handling this kind of scenario, whereby a Neko function can be stored into
a static variable, allowing a C/C++ event handler function to act as a proxy, thereby calling the stored
Neko function.


Pages:
1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064