Skip to content

dlopen(NULL) returns a handle for libjulia-internal, not the process #120

Open
@maleadt

Description

@maleadt

The CBinding.jl code contains the following:

CBinding.jl/src/context.jl

Lines 242 to 244 in 38e76e5

# WARNING: risky hack to trick Julia dlopen into ccalling the C dlopen with NULL (meaning to dlopen current process rather than a library)
struct _NullCString <: AbstractString end
Base.cconvert(::Type{Cstring}, ::_NullCString) = Cstring(C_NULL)

CBinding.jl/src/context.jl

Lines 293 to 294 in 38e76e5

lib = dlopen(_NullCString())
lib == C_NULL && error("Failed to dlopen Julia process")

This broke on 1.10, but PkgEval spotted it and it will soon be fixed, see JuliaLang/julia#49010 (comment) and JuliaLang/julia#49611

However, it should be noted that this operation does not actually return a handle to the process, but to libjulia-internal (JuliaLang/julia#49010 (comment)). Opening an issue to see if this is intended, and if so, maybe the comment should be updated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions