Skip to content

Commit

Permalink
try to fix loading global libpython for pyinitialize(C_NULL) on Windo…
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengj committed Feb 20, 2015
1 parent 183c915 commit b4974b0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/pyinit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ function pyinitialize(libpy::Ptr{Void}, programname="")
error("Calling pyinitialize after pyfinalize is not supported")
end

global const libpython = libpy == C_NULL ? ccall(:jl_load_dynamic_library, Ptr{Void}, (Ptr{Uint8},Cuint), C_NULL, 0) : libpy
# If libpy==NULL, assume that libpython is linked into the global
# namespace. On windows, jl_exe_handle stores this, whereas on
# other systems jl_dl_handle is equivalent to dlopen(NULL) and stores
# this. (These are internal vars present in Julia 0.2/0.3/0.4.)
global const libpython = libpy == C_NULL ? unsafe_load(cglobal((@windows ? :jl_exe_handle : :jl_dl_handle), Ptr{Void})) : libpy

# cache the Python version as a Julia VersionNumber
global const pyversion = convert(VersionNumber, split(Py_GetVersion(libpython))[1])
Expand Down

0 comments on commit b4974b0

Please sign in to comment.