From 50c09e074a49ddaeb039324413a2f7dbd90bf171 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Tue, 15 Dec 2020 18:53:27 +0200 Subject: [PATCH] dl: always use dl.get_shared_library_extension() for dl.dl_ext --- vlib/dl/dl.v | 12 ++++++++++++ vlib/dl/dl_nix.c.v | 12 ------------ vlib/dl/dl_windows.c.v | 1 - 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/vlib/dl/dl.v b/vlib/dl/dl.v index e15c3353cb..630ea750b7 100644 --- a/vlib/dl/dl.v +++ b/vlib/dl/dl.v @@ -2,4 +2,16 @@ module dl pub const ( 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 +} diff --git a/vlib/dl/dl_nix.c.v b/vlib/dl/dl_nix.c.v index 58553255fe..1f40b8068c 100644 --- a/vlib/dl/dl_nix.c.v +++ b/vlib/dl/dl_nix.c.v @@ -4,7 +4,6 @@ module dl pub const ( rtld_now = C.RTLD_NOW rtld_lazy = C.RTLD_LAZY - dl_ext = get_shared_library_extension() ) 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 { 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 -} diff --git a/vlib/dl/dl_windows.c.v b/vlib/dl/dl_windows.c.v index 90b3438319..d5f91a1bb3 100644 --- a/vlib/dl/dl_windows.c.v +++ b/vlib/dl/dl_windows.c.v @@ -3,7 +3,6 @@ module dl pub const ( rtld_now = 0 rtld_lazy = 0 - dl_ext = '.dll' ) fn C.LoadLibrary(libfilename C.LPCWSTR) voidptr