Skip to content

Commit 5669d62

Browse files
isuruftkf
authored andcommitted
Use libpy_handle instead of libpython
1 parent a7c976a commit 5669d62

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/pyinit.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ function __init__()
8686
error("Using Conda.jl python, but location of $python seems to have moved to $(Conda.PYTHONDIR). Re-run Pkg.build(\"PyCall\") and restart Julia.")
8787
end
8888

89+
global libpy_handle
90+
8991
# issue #189
9092
libpy_handle = libpython === nothing ? C_NULL :
9193
Libdl.dlopen(libpython, Libdl.RTLD_LAZY|Libdl.RTLD_GLOBAL)

src/startup.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,15 @@ if libpython == nothing
125125
end
126126
else
127127
macro pysym(func)
128-
:(($(esc(func)), libpython))
128+
:(Libdl.dlsym(libpy_handle, $(esc(func))))
129129
end
130130
macro pyglobal(name)
131-
:(cglobal(($(esc(name)), libpython)))
131+
:(convert(Ptr{Cvoid}, Libdl.dlsym(libpy_handle, $(esc(name)))))
132132
end
133133
macro pyglobalobj(name)
134-
:(cglobal(($(esc(name)), libpython), PyObject_struct))
134+
:(convert(Ptr{PyObject_struct}, Libdl.dlsym(libpy_handle, $(esc(name)))))
135135
end
136136
macro pyglobalobjptr(name)
137-
:(unsafe_load(cglobal(($(esc(name)), libpython), Ptr{PyObject_struct})))
137+
:(unsafe_load(convert(Ptr{Ptr{PyObject_struct}}, Libdl.dlsym(libpy_handle, $(esc(name))))))
138138
end
139139
end

0 commit comments

Comments
 (0)