2020-05-01 20:34:27 +03:00
|
|
|
module dl
|
|
|
|
|
|
|
|
pub const (
|
|
|
|
version = 1
|
2020-12-15 19:55:04 +03:00
|
|
|
dl_ext = get_shared_library_extension()
|
2020-05-01 20:34:27 +03:00
|
|
|
)
|
2020-12-15 19:53:27 +03:00
|
|
|
|
2020-12-18 20:41:01 +03:00
|
|
|
// get_shared_library_extension returns the platform dependent shared library extension
|
|
|
|
// i.e. .dll on windows, .so on most unixes, .dylib on macos.
|
2021-02-23 10:46:28 +03:00
|
|
|
[inline]
|
2020-12-15 19:53:27 +03:00
|
|
|
pub fn get_shared_library_extension() string {
|
|
|
|
mut res := '.so'
|
|
|
|
$if macos {
|
|
|
|
res = '.dylib'
|
|
|
|
}
|
|
|
|
$if windows {
|
|
|
|
res = '.dll'
|
|
|
|
}
|
|
|
|
return res
|
|
|
|
}
|
2021-02-23 10:46:28 +03:00
|
|
|
|
|
|
|
// get_libname returns a library name with the operating system specific extension for
|
|
|
|
// shared libraries.
|
|
|
|
[inline]
|
|
|
|
pub fn get_libname(libname string) string {
|
|
|
|
return '$libname$dl.dl_ext'
|
|
|
|
}
|