mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
dl: always use dl.get_shared_library_extension() for dl.dl_ext
This commit is contained in:
parent
3e85c759aa
commit
50c09e074a
12
vlib/dl/dl.v
12
vlib/dl/dl.v
@ -2,4 +2,16 @@ module dl
|
|||||||
|
|
||||||
pub const (
|
pub const (
|
||||||
version = 1
|
version = 1
|
||||||
|
dl_ext = get_shared_library_extension()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
pub fn get_shared_library_extension() string {
|
||||||
|
mut res := '.so'
|
||||||
|
$if macos {
|
||||||
|
res = '.dylib'
|
||||||
|
}
|
||||||
|
$if windows {
|
||||||
|
res = '.dll'
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
@ -4,7 +4,6 @@ module dl
|
|||||||
pub const (
|
pub const (
|
||||||
rtld_now = C.RTLD_NOW
|
rtld_now = C.RTLD_NOW
|
||||||
rtld_lazy = C.RTLD_LAZY
|
rtld_lazy = C.RTLD_LAZY
|
||||||
dl_ext = get_shared_library_extension()
|
|
||||||
)
|
)
|
||||||
|
|
||||||
fn C.dlopen(filename charptr, flags int) voidptr
|
fn C.dlopen(filename charptr, flags int) voidptr
|
||||||
@ -27,14 +26,3 @@ pub fn close(handle voidptr) bool {
|
|||||||
pub fn sym(handle voidptr, symbol string) voidptr {
|
pub fn sym(handle voidptr, symbol string) voidptr {
|
||||||
return C.dlsym(handle, symbol.str)
|
return C.dlsym(handle, symbol.str)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_shared_library_extension() string {
|
|
||||||
mut res := '.so'
|
|
||||||
$if macos {
|
|
||||||
res = '.dylib'
|
|
||||||
}
|
|
||||||
$if windows {
|
|
||||||
res = '.dll'
|
|
||||||
}
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
|
@ -3,7 +3,6 @@ module dl
|
|||||||
pub const (
|
pub const (
|
||||||
rtld_now = 0
|
rtld_now = 0
|
||||||
rtld_lazy = 0
|
rtld_lazy = 0
|
||||||
dl_ext = '.dll'
|
|
||||||
)
|
)
|
||||||
|
|
||||||
fn C.LoadLibrary(libfilename C.LPCWSTR) voidptr
|
fn C.LoadLibrary(libfilename C.LPCWSTR) voidptr
|
||||||
|
Loading…
Reference in New Issue
Block a user