Skip to content

Instantly share code, notes, and snippets.

@Kaiepi
Created April 23, 2018 00:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kaiepi/a6ce74584ef78e5e90d3bad5aa3debd6 to your computer and use it in GitHub Desktop.
Save Kaiepi/a6ce74584ef78e5e90d3bad5aa3debd6 to your computer and use it in GitHub Desktop.
NativeCall function pointer method wrapping
method first(::?CLASS:D: --> int32) {
my &cb := nativecast(:(Pointer, Event --> int32), $!h_first<>);
&cb does sub (Pointer, Event --> int32) is native(LIB) { * }
my Event $e .= new;
cb($!h_ref, $e);
$e;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment