1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

boehm-gc: support a [keep_args_alive] tag for C functions (#9641)

This commit is contained in:
Uwe Krüger
2021-04-09 12:13:49 +02:00
committed by GitHub
parent 4feb09fa5b
commit 84fa1ae444
10 changed files with 204 additions and 5 deletions

View File

@@ -4222,6 +4222,11 @@ fn bar() {
foo() // will not be called if `-d debug` is not passed
}
// The memory pointed to by the pointer arguments of this function will not be
// freed by the garbage collector (if in use) before the function returns
[keep_args_alive]
fn C.my_external_function(voidptr, int, voidptr) int
// Calls to following function must be in unsafe{} blocks.
// Note that the code in the body of `risky_business()` will still be
// checked, unless you also wrap it in `unsafe {}` blocks.