@@ -5,6 +5,9 @@ import Base: close, eof, flush, read, readall, write
55import Base. Libc: errno, strerror
66export StringEncoder, StringDecoder, encode, decode
77
8+ include (" ../deps/deps.jl" )
9+
10+
811# # iconv wrappers
912
1013const E2BIG = 7
@@ -13,13 +16,13 @@ const EILSEQ = 84
1316
1417function iconv_close (cd:: Ptr{Void} )
1518 if cd != C_NULL
16- ccall ((:iconv_close , :libc ), Cint, (Ptr{Void},), cd) == 0 ||
19+ ccall ((:iconv_close , libiconv_path ), Cint, (Ptr{Void},), cd) == 0 ||
1720 error (" failed to call iconv_close: error $(errno ()) ($(strerror (errno ())) )" )
1821 end
1922end
2023
2124function iconv_open (tocode, fromcode)
22- p = ccall ((:iconv_open , :libc ), Ptr{Void}, (Cstring, Cstring), tocode, fromcode)
25+ p = ccall ((:iconv_open , libiconv_path ), Ptr{Void}, (Cstring, Cstring), tocode, fromcode)
2326 if p != Ptr {Void} (- 1 )
2427 return p
2528 elseif errno () == EINVAL
@@ -66,7 +69,7 @@ function iconv!(cd::Ptr{Void}, inbuf::Vector{UInt8}, outbuf::Vector{UInt8},
6669 inbytesleft_orig = inbytesleft[]
6770 outbytesleft[] = BUFSIZE
6871
69- ret = ccall ((:iconv , :libc ), Csize_t,
72+ ret = ccall ((:iconv , libiconv_path ), Csize_t,
7073 (Ptr{Void}, Ptr{Ptr{UInt8}}, Ref{Csize_t}, Ptr{Ptr{UInt8}}, Ref{Csize_t}),
7174 cd, inbufptr, inbytesleft, outbufptr, outbytesleft)
7275
@@ -98,7 +101,7 @@ function iconv_reset!(s::Union{StringEncoder, StringDecoder})
98101
99102 s. outbufptr[] = pointer (s. outbuf)
100103 s. outbytesleft[] = BUFSIZE
101- ret = ccall ((:iconv , :libc ), Csize_t,
104+ ret = ccall ((:iconv , libiconv_path ), Csize_t,
102105 (Ptr{Void}, Ptr{Ptr{UInt8}}, Ref{Csize_t}, Ptr{Ptr{UInt8}}, Ref{Csize_t}),
103106 s. cd, C_NULL , C_NULL , s. outbufptr, s. outbytesleft)
104107
0 commit comments