Hi I hope someone could help me to understand why my code errors. I am trying
to wrap this http://pcre.org/current/doc/html/pcre2_substitute.html function
from the pcre2 library. I am working on latest master as it comes with pcre2.
My wrap look like:
function my_replace(s::AbstractString, pat::Regex, rep_in)
offset=0
subject = bytestring(s)
rep = bytestring(rep_in)
buffer = Array(UInt8, 256)
re = pat.regex
rc = ccall((:pcre2_substitute_8, Base.PCRE.PCRE_LIB), Cint,
(Ptr{Void}, Ptr{UInt8}, Csize_t, Csize_t, Cuint, Ptr{Void},
Ptr{Void}, Ptr{UInt8}, Csize_t, Ptr{UInt8}, Csize_t),
re, subject, sizeof(subject), offset, pat.match_options,
pat.match_data,
Base.PCRE.MATCH_CONTEXT, rep, sizeof(rep), buffer,
sizeof(buffer))
bytestring(pointer(buffer))
end
julia> my_replace("ads10as", r"a(\d+)", "\$1")
Please submit a bug report with steps to reproduce this fault, and any error
messages that follow (in their entirety). Tha
Exception: EXCEPTION_ACCESS_VIOLATION at 0x65811787 -- pcre2_substitute_8 at
(unknown line)
pcre2_substitute_8 at C:\Users\Hoegh\Julia-0.4.0-dev-03-06\bin\libpcre2-8.DLL
(unknown line)
my_replace at none:7
jl_apply_generic at C:\Users\Hoegh\Julia-0.4.0-dev-03-06\bin\libjulia.dll
(unknown line)
jl_interpret_toplevel_expr at
C:\Users\Hoegh\Julia-0.4.0-dev-03-06\bin\libjulia.dll (unknown line)
jl_interpret_toplevel_thunk_with at
C:\Users\Hoegh\Julia-0.4.0-dev-03-06\bin\libjulia.dll (unknown line)
jl_eval_with_compiler_p at
C:\Users\Hoegh\Julia-0.4.0-dev-03-06\bin\libjulia.dll (unknown line)
jl_toplevel_eval_in at C:\Users\Hoegh\Julia-0.4.0-dev-03-06\bin\libjulia.dll
(unknown line)
eval_user_input at REPL.jl:62
jlcall_eval_user_input_1356 at (unknown line)
jl_apply_generic at C:\Users\Hoegh\Julia-0.4.0-dev-03-06\bin\libjulia.dll
(unknown line)
anonymous at task.jl:91
jl_unprotect_stack at C:\Users\Hoegh\Julia-0.4.0-dev-03-06\bin\libjulia.dll
(unknown line)