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:
18
vlib/dl/dl_windows.c.v
Normal file
18
vlib/dl/dl_windows.c.v
Normal 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)
|
||||
}
|
Reference in New Issue
Block a user