@@ -20,17 +20,17 @@ export MagickWand,
20
20
21
21
const init_envs = Dict {String,String} ()
22
22
23
- # Find the library
24
- const depsfile = joinpath (dirname (@__FILE__ ), " .." , " deps" , " deps.jl" )
23
+ const depsfile = joinpath (dirname (@__DIR__ ), " deps" , " deps.jl" )
25
24
if isfile (depsfile)
26
25
include (depsfile)
27
26
else
28
27
error (" ImageMagick not properly installed. Please run Pkg.build(\" ImageMagick\" ) then restart Julia." )
29
28
end
30
29
31
- const libmagic = Ref {Ptr{Void}} ()
30
+ const libmagick = Ref {Ptr{Void}} ()
32
31
33
32
const MagickWandGenesis = Ref {Ptr{Void}} ()
33
+ const MagickWandTerminus = Ref {Ptr{Void}} ()
34
34
const NewMagickWand = Ref {Ptr{Void}} ()
35
35
const DestroyMagickWand = Ref {Ptr{Void}} ()
36
36
const NewPixelWand = Ref {Ptr{Void}} ()
@@ -75,18 +75,23 @@ const MagickRelinquishMemory = Ref{Ptr{Void}}()
75
75
const MagickQueryConfigureOption = Ref {Ptr{Void}} ()
76
76
const MagickQueryConfigureOptions = Ref {Ptr{Void}} ()
77
77
78
- const libversionref = Ref {VersionNumber} ()
79
78
80
- loadsym (fun:: Symbol ) = Libdl. dlsym (libmagic[], fun)
79
+ initialize () = ccall (MagickWandGenesis[], Void, ())
80
+ destroy () = ccall (MagickWandTerminus[], Void, ())
81
+
82
+ loadsym (fun:: Symbol ) = Libdl. dlsym (libmagick[], fun)
83
+
84
+ getlibversion () = VersionNumber (join (split (queryoption (" LIB_VERSION_NUMBER" ), ' ,' )[1 : 3 ], ' .' ))
81
85
82
86
function __init__ ()
83
87
for (key, value) in init_envs
84
88
ENV [key] = value
85
89
end
86
90
87
- libmagic [] = Libdl. dlopen (libwand, Libdl. RTLD_GLOBAL)
91
+ libmagick [] = Libdl. dlopen (libwand, Libdl. RTLD_GLOBAL)
88
92
89
93
MagickWandGenesis[] = loadsym (:MagickWandGenesis )
94
+ MagickWandTerminus[] = loadsym (:MagickWandTerminus )
90
95
NewMagickWand[] = loadsym (:NewMagickWand )
91
96
DestroyMagickWand[] = loadsym (:DestroyMagickWand )
92
97
NewPixelWand[] = loadsym (:NewPixelWand )
@@ -131,10 +136,9 @@ function __init__()
131
136
MagickQueryConfigureOptions[] = loadsym (:MagickQueryConfigureOptions )
132
137
MagickQueryConfigureOption[] = loadsym (:MagickQueryConfigureOption )
133
138
134
- ccall (MagickWandGenesis[], Void, () )
139
+ initialize ( )
135
140
136
- libversionref[] = VersionNumber (join (split (queryoption (" LIB_VERSION_NUMBER" ), ' ,' )[1 : 3 ], ' .' ))
137
- global libversion = libversionref[]
141
+ global libversion = getlibversion ()
138
142
end
139
143
140
144
# Constants
0 commit comments