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

cgen,checker: support simple voidptr casts in consts, without delaying the initialisation to _vinit (#15996)

This commit is contained in:
Delyan Angelov
2022-10-08 13:14:26 +03:00
committed by GitHub
parent 272b3cf8c3
commit 754c387d1b
6 changed files with 50 additions and 1 deletions

View File

@@ -38,5 +38,9 @@ pub fn sym(handle voidptr, symbol string) voidptr {
// that occurred from a call to one of the `dl` functions, since the last
// call to dlerror()
pub fn dlerror() string {
return unsafe { cstring_to_vstring(C.dlerror()) }
sptr := C.dlerror()
if sptr == unsafe { nil } {
return ''
}
return unsafe { cstring_to_vstring(sptr) }
}