Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move Libdl to stdlib #25459

Merged
merged 1 commit into from
Jan 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
move Libdl to stdlib
  • Loading branch information
JeffBezanson committed Jan 9, 2018
commit 16a3a6c1a847c06c9de9bacb7b658088b0d7c6e7
1 change: 0 additions & 1 deletion base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export
StackTraces,
Sys,
Libc,
Libdl,
LinAlg,
BLAS,
LAPACK,
Expand Down
2 changes: 2 additions & 0 deletions base/linalg/blas.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ const liblapack = Base.liblapack_name

import ..LinAlg: BlasReal, BlasComplex, BlasFloat, BlasInt, DimensionMismatch, checksquare, stride1, chkstride1, axpy!

import Libdl

# utility routines
function vendor()
lib = Libdl.dlopen_e(Base.libblas_name)
Expand Down
34 changes: 20 additions & 14 deletions base/sysimg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,13 @@ include("version.jl")
include("sysinfo.jl")
include("libc.jl")
using .Libc: getpid, gethostname, time
include("libdl.jl")
using .Libdl: DL_LOAD_PATH

const DL_LOAD_PATH = String[]
if Sys.isapple()
push!(DL_LOAD_PATH, "@loader_path/julia")
push!(DL_LOAD_PATH, "@loader_path")
end

include("env.jl")

# Scheduling
Expand Down Expand Up @@ -409,12 +414,6 @@ include("client.jl")
# misc useful functions & macros
include("util.jl")

# dense linear algebra
include("linalg/linalg.jl")
using .LinAlg
const ⋅ = dot
const × = cross

# statistics
include("statistics.jl")

Expand All @@ -427,12 +426,6 @@ include("libgit2/libgit2.jl")
# package manager
include("pkg/pkg.jl")

# sparse matrices, vectors, and sparse linear algebra
include("sparse/sparse.jl")
using .SparseArrays

include("asyncmap.jl")

# worker threads
include("threadcall.jl")

Expand All @@ -448,6 +441,18 @@ import Base64

INCLUDE_STATE = 2

# dense linear algebra
include("linalg/linalg.jl")
using .LinAlg
const ⋅ = dot
const × = cross

# sparse matrices, vectors, and sparse linear algebra
include("sparse/sparse.jl")
using .SparseArrays

include("asyncmap.jl")

include("multimedia.jl")
using .Multimedia

Expand Down Expand Up @@ -505,6 +510,7 @@ Base.require(:Unicode)
Base.require(:Distributed)
Base.require(:Printf)
Base.require(:Future)
Base.require(:Libdl)

@eval Base begin
@deprecate_binding Test root_module(:Test) true ", run `using Test` instead"
Expand Down
2 changes: 2 additions & 0 deletions contrib/julia-config.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env julia
# This file is a part of Julia. License is MIT: https://julialang.org/license

import Libdl

const options = [
"--cflags",
"--ldflags",
Expand Down
1 change: 0 additions & 1 deletion doc/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ const PAGES = [
"base/iterators.md",
"base/c.md",
"base/libc.md",
"base/libdl.md",
"base/stacktraces.md",
"base/simd-types.md",
],
Expand Down
1 change: 0 additions & 1 deletion doc/src/base/base.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ Base.Iterators
Base.LAPACK
Base.LibGit2
Base.Libc
Base.Libdl
Base.LinAlg
Base.Markdown
Base.Meta
Expand Down
9 changes: 0 additions & 9 deletions doc/src/base/constants.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,3 @@ See also:
* `Libc.MS_ASYNC`
* `Libc.MS_INVALIDATE`
* `Libc.MS_SYNC`
* [`Libdl.DL_LOAD_PATH`](@ref)
* [`Libdl.RTLD_DEEPBIND`](@ref Base.Libdl.RTLD_NOW)
* [`Libdl.RTLD_LOCAL`](@ref Base.Libdl.RTLD_NOW)
* [`Libdl.RTLD_NOLOAD`](@ref Base.Libdl.RTLD_NOW)
* [`Libdl.RTLD_LAZY`](@ref Base.Libdl.RTLD_NOW)
* [`Libdl.RTLD_NOW`](@ref)
* [`Libdl.RTLD_GLOBAL`](@ref Base.Libdl.RTLD_NOW)
* [`Libdl.RTLD_NODELETE`](@ref Base.Libdl.RTLD_NOW)
* [`Libdl.RTLD_FIRST`](@ref Base.Libdl.RTLD_NOW)
15 changes: 0 additions & 15 deletions doc/src/base/libdl.md

This file was deleted.

13 changes: 13 additions & 0 deletions stdlib/Libdl/docs/src/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Dynamic Linker

```@docs
Libdl.dlopen
Libdl.dlopen_e
Libdl.RTLD_NOW
Libdl.dlsym
Libdl.dlsym_e
Libdl.dlclose
Libdl.dlext
Libdl.find_library
Libdl.DL_LOAD_PATH
```
11 changes: 5 additions & 6 deletions base/libdl.jl → stdlib/Libdl/src/Libdl.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

__precompile__(true)

module Libdl
@doc """
Interface to libdl. Provides dynamic linking support.
""" -> Libdl

import Base.DL_LOAD_PATH

export DL_LOAD_PATH, RTLD_DEEPBIND, RTLD_FIRST, RTLD_GLOBAL, RTLD_LAZY, RTLD_LOCAL,
RTLD_NODELETE, RTLD_NOLOAD, RTLD_NOW, dlclose, dlopen, dlopen_e, dlsym, dlsym_e,
dlpath, find_library, dlext, dllist
Expand All @@ -15,11 +19,7 @@ export DL_LOAD_PATH, RTLD_DEEPBIND, RTLD_FIRST, RTLD_GLOBAL, RTLD_LAZY, RTLD_LOC
When calling [`dlopen`](@ref), the paths in this list will be searched first, in
order, before searching the system locations for a valid library handle.
"""
const DL_LOAD_PATH = String[]
if Sys.isapple()
push!(DL_LOAD_PATH, "@loader_path/julia")
push!(DL_LOAD_PATH, "@loader_path")
end
DL_LOAD_PATH

# note: constants to match JL_RTLD_* in src/julia.h, translated
# to system-specific values by JL_RTLD macro in src/dlload.c
Expand Down Expand Up @@ -47,7 +47,6 @@ applicable.
""" ->
(RTLD_DEEPBIND, RTLD_FIRST, RTLD_GLOBAL, RTLD_LAZY, RTLD_LOCAL, RTLD_NODELETE, RTLD_NOLOAD, RTLD_NOW)


"""
dlsym(handle, sym)

Expand Down
2 changes: 2 additions & 0 deletions test/libdl.jl → stdlib/Libdl/test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

import Libdl

# these could fail on an embedded installation
# but for now, we don't handle that case
dlls = Libdl.dllist()
Expand Down
2 changes: 2 additions & 0 deletions stdlib/SuiteSparse/src/cholmod.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import Base.LinAlg: (\),
using ..SparseArrays
using Base.Printf.@printf

import Libdl

export
Dense,
Factor,
Expand Down
2 changes: 2 additions & 0 deletions test/ccall.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import Base.copy, Base.==

import Libdl

const libccalltest = "libccalltest"

const verbose = false
Expand Down
2 changes: 1 addition & 1 deletion test/choosetests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function choosetests(choices = [])
"replutil", "sets", "goto", "llvmcall", "llvmcall2", "grisu",
"some", "meta", "stacktraces", "libgit2", "docs",
"markdown", "serialize", "misc", "threads",
"enums", "cmdlineargs", "i18n", "libdl", "int",
"enums", "cmdlineargs", "i18n", "int",
"checked", "bitset", "floatfuncs", "compile", "inline",
"boundscheck", "error", "ambiguous", "cartesian", "asmvariant", "osutils",
"channels", "iostream", "specificity", "codegen", "codevalidation",
Expand Down
2 changes: 2 additions & 0 deletions test/cmdlineargs.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

import Libdl

catcmd = `cat`
if Sys.iswindows()
busybox = joinpath(Sys.BINDIR, "busybox.exe")
Expand Down
2 changes: 1 addition & 1 deletion test/compile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ try
Dict(s => Base.module_uuid(Base.root_module(s)) for s in
[:Base64, :CRC32c, :Dates, :DelimitedFiles, :FileWatching, :Future,
:IterativeEigensolvers, :Logging, :Mmap, :Printf, :Profile, :SharedArrays,
:SuiteSparse, :Test, :Unicode, :Distributed]))
:SuiteSparse, :Test, :Unicode, :Distributed, :Libdl]))
@test discard_module.(deps) == deps1

@test current_task()(0x01, 0x4000, 0x30031234) == 2
Expand Down