mirror of
https://github.com/carp-lang/Carp.git
synced 2024-11-05 04:44:12 +03:00
36f41e39a7
This functions are useful with binding callback based C APIs
8 lines
584 B
Plaintext
8 lines
584 B
Plaintext
(defmodule Function
|
|
(doc unsafe-ptr "returns void pointer to the function passed in."
|
|
"This is unsafe as unsafe-ptr can't check the value passed in is a function.")
|
|
(deftemplate unsafe-ptr (Fn [(Ref a)] (Ptr ())) "void* $NAME($a *fn)" "$DECL { return fn->callback; }")
|
|
(doc unsafe-env-ptr "returns void pointer to the environment captured by a lambda."
|
|
"This is unsafe as unsafe-env-ptr can't check the value passed in is a function.")
|
|
(deftemplate unsafe-env-ptr (Fn [(Ref a)] (Ptr ())) "void* $NAME($a *fn)" "$DECL { return fn->env; }"))
|