mirror of
https://github.com/janet-lang/janet
synced 2025-11-02 00:23:02 +00:00
Make sure void return types work as expected.
This commit is contained in:
@@ -77,3 +77,11 @@ big struct_big(int i, double d) {
|
||||
ret.c = ret.a + ret.b + 1000;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void void_fn(void) {
|
||||
printf("void fn ran\n");
|
||||
}
|
||||
|
||||
void void_ret_fn(int x) {
|
||||
printf("void fn ran: %d\n", x);
|
||||
}
|
||||
|
||||
@@ -62,10 +62,17 @@
|
||||
[i d]
|
||||
(native-call struct-big-fn-pointer struct-big-fn-sig i d))
|
||||
|
||||
(def void-fn-pointer (native-lookup module "void_fn"))
|
||||
(def void-fn-sig (native-signature :default :void))
|
||||
(defn void-fn
|
||||
[]
|
||||
(native-call void-fn-pointer void-fn-sig))
|
||||
|
||||
#
|
||||
# Call functions
|
||||
#
|
||||
|
||||
(pp (void-fn))
|
||||
(pp (int-fn 10 20))
|
||||
(pp (double-fn 1.5 2.5 3.5))
|
||||
(pp (double-many 1 2 3 4 5 6))
|
||||
|
||||
Reference in New Issue
Block a user