Skip to content

Commit

Permalink
move Libdl to stdlib
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Jan 9, 2018
1 parent 4f87318 commit 6f1d9de
Show file tree
Hide file tree
Showing 15 changed files with 55 additions and 50 deletions.
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
7 changes: 5 additions & 2 deletions doc/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ if Sys.iswindows()
cp_q("../stdlib/Unicode/docs/src/index.md", "src/stdlib/unicode.md")
cp_q("../stdlib/Distributed/docs/src/index.md", "src/stdlib/distributed.md")
cp_q("../stdlib/Printf/docs/src/index.md", "src/stdlib/printf.md")
cp_q("../stdlib/Libdl/docs/src/index.md", "src/stdlib/libdl.md")
else
symlink_q("../../../stdlib/DelimitedFiles/docs/src/index.md", "src/stdlib/delimitedfiles.md")
symlink_q("../../../stdlib/Test/docs/src/index.md", "src/stdlib/test.md")
Expand All @@ -48,6 +49,7 @@ else
symlink_q("../../../stdlib/Unicode/docs/src/index.md", "src/stdlib/unicode.md")
symlink_q("../../../stdlib/Distributed/docs/src/index.md", "src/stdlib/distributed.md")
symlink_q("../../../stdlib/Printf/docs/src/index.md", "src/stdlib/printf.md")
symlink_q("../../../stdlib/Libdl/docs/src/index.md", "src/stdlib/libdl.md")
end

const PAGES = [
Expand Down Expand Up @@ -128,6 +130,7 @@ const PAGES = [
"stdlib/iterativeeigensolvers.md",
"stdlib/unicode.md",
"stdlib/printf.md",
"stdlib/libdl.md",
],
"Developer Documentation" => [
"devdocs/reflection.md",
Expand Down Expand Up @@ -163,12 +166,12 @@ const PAGES = [
]

using DelimitedFiles, Test, Mmap, SharedArrays, Profile, Base64, FileWatching, CRC32c,
Dates, IterativeEigensolvers, Unicode, Distributed, Printf
Dates, IterativeEigensolvers, Unicode, Distributed, Printf, Libdl

makedocs(
build = joinpath(pwd(), "_build/html/en"),
modules = [Base, Core, BuildSysImg, DelimitedFiles, Test, Mmap, SharedArrays, Profile,
Base64, FileWatching, Dates, IterativeEigensolvers, Unicode, Distributed, Printf],
Base64, FileWatching, Dates, IterativeEigensolvers, Unicode, Distributed, Printf, Libdl],
clean = false,
doctest = "doctest" in ARGS,
linkcheck = "linkcheck" in ARGS,
Expand Down
1 change: 0 additions & 1 deletion doc/src/stdlib/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/stdlib/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/stdlib/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 @@ -13,6 +13,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

0 comments on commit 6f1d9de

Please sign in to comment.