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

Added documentation to libdl module #52825

Merged
merged 6 commits into from
Feb 8, 2024

Conversation

RichieWilynnton
Copy link
Contributor

@RichieWilynnton RichieWilynnton commented Jan 9, 2024

Part of #52725

stdlib/Libdl/docs/src/index.md Outdated Show resolved Hide resolved
@stevengj
Copy link
Member

stevengj commented Jan 9, 2024

The current description this PR seems a little bit misleading to me — even without Libdl, you can link Julia code to runtime shared libraries via the ccall intrinsic. The Libdl module provides additional lower-level facilities to manipulate shared libraries: to search for shared libraries in memory or the filesystem, to manually load them (with finer-grained control over the runtime linker options), and to look up library symbols as low-level pointers.

@staticfloat
Copy link
Member

The current description this PR seems a little bit misleading to me — even without Libdl, you can link Julia code to runtime shared libraries via the ccall intrinsic.

I think that's a bit of a distinction without a difference; ccall itself loads Libdl and uses the code in it:

else if (jl_libdl_dlopen_func != NULL) {
// Call `dlopen(lib_val)`; this is the correct path for the `LazyLibrary` case,
// but it also takes any other value, and so we define `dlopen(x::Any) = throw(TypeError(...))`.
lib_ptr = jl_unbox_voidpointer(jl_apply_generic(jl_libdl_dlopen_func, &lib_val, 1));

@stevengj
Copy link
Member

stevengj commented Jan 9, 2024

I think that's a bit of a distinction without a difference; ccall itself loads Libdl and uses the code in it:

Good point, but in principle that could change in the future, being an internal implementation detail. My point is that we don't want to imply that ordinary users need to import Libdl in order to call runtime shared libraries.

@RichieWilynnton
Copy link
Contributor Author

Then shall I reference ccall itself in this documentation?

@RichieWilynnton
Copy link
Contributor Author

The Libdl module in Julia provides specialized and lower-level facilities for dynamic linking with shared libraries. While Julia
inherently supports linking to runtime shared libraries through the ccall intrinsic, Libdl extends this capability by offering additional, more
granular control. It enables users to search for shared libraries both in memory and the filesystem, manually load them with specific runtime linker options, and look up
library symbols as low-level pointers.

Maybe something like this?

@staticfloat
Copy link
Member

Sure, that sounds good to me.

stdlib/Libdl/src/Libdl.jl Outdated Show resolved Hide resolved
@stevengj
Copy link
Member

Now that #52723 is merged, you'll need to update

@testset "Docstrings" begin
undoc = Docs.undocumented_names(Libdl)
@test_broken isempty(undoc)
@test undoc == [:Libdl]
end
to

@testset "Docstrings" begin
    @test isempty(Docs.undocumented_names(Libdl))
end

@stevengj
Copy link
Member

Looks like you had a merge problem, and a whole bunch of unrelated commits are now included in this PR. 😢

stdlib/Libdl/src/Libdl.jl Outdated Show resolved Hide resolved
Co-authored-by: Steven G. Johnson <stevenj@mit.edu>
Co-authored-by: Steven G. Johnson <stevenj@mit.edu>
@vtjnash vtjnash added the docs This change adds or pertains to documentation label Jan 30, 2024
Co-authored-by: Max Horn <max@quendi.de>
@fingolfin
Copy link
Member

Can one get a preview of the documentation from CI, or do I need to checkout this branch locally to verify it builds the manual correctly with the recent change to use a @docs block?

@inkydragon
Copy link
Member

get a preview of the documentation from CI

We need this #45744 and then upload the generated HTML

@vtjnash
Copy link
Member

vtjnash commented Feb 7, 2024

It looks like doctest is supposed to give you a download link, but fails due to:

2024-02-06 23:31:40 EST	┌ Info: Unable to deploy the documentation: invalid GIT_VERSION_INFO
2024-02-06 23:31:41 EST	│ GIT_VERSION_INFO.tagged_commit: false
2024-02-06 23:31:41 EST	└ GIT_VERSION_INFO.branch: RichieWilynnton:libdlDoc
2024-02-06 23:31:41 EST	Build & deploy of docs finished.
2024-02-06 23:31:41 EST	Compress and upload HTML docs
2024-02-06 23:31:41 EST	2024-02-07 04:31:41 INFO   File not found: julia-f6e0554e38-htmldocs.tar.gz
2024-02-06 23:31:41 EST	2024-02-07 04:31:41 INFO   No files matched paths: julia-f6e0554e38-htmldocs.tar.gz

@KristofferC KristofferC merged commit 815cfd5 into JuliaLang:master Feb 8, 2024
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This change adds or pertains to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants