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

dl: add dynamic load module

This commit is contained in:
Sandro Martini
2020-04-28 11:53:55 +02:00
committed by GitHub
parent 7bf8731778
commit 761fb930ce
3 changed files with 65 additions and 0 deletions

18
vlib/dl/dl_windows.c.v Normal file
View File

@ -0,0 +1,18 @@
module dl
pub const (
RTLD_NOW = 0
DL_EXT = '.dll'
)
fn C.LoadLibraryA(libfilename byteptr) voidptr
fn C.GetProcAddress(handle voidptr, procname byteptr) voidptr
pub fn open(filename string, flags int) voidptr {
res := C.LoadLibraryA(filename.str)
return res
}
pub fn sym(handle voidptr, symbol string) voidptr {
return C.GetProcAddress(handle, symbol.str)
}