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