From 8c4d165a5ffbc1f8b3947fa9306f7ebb91fb7d9c Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Sun, 6 Nov 2022 23:03:32 -0500 Subject: [PATCH] Use Ptr{UInt8} instead of Cstring --- src/hsl_mc66.jl | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/hsl_mc66.jl b/src/hsl_mc66.jl index ee76e95..ad9c6a8 100644 --- a/src/hsl_mc66.jl +++ b/src/hsl_mc66.jl @@ -32,34 +32,32 @@ end # Thanks to `nm -D libhsl_mc66.so`! function mc66s(m, n, nz, irn, jcn, nblocks, control, seed, row_order, info, rowptr, column_order, colptr, netcut, rowdiff, kblocks) ccall((:__hsl_mc66_simple_MOD_monet, libhsl_mc66), - Cvoid, + Cvoid, (Ref{Int32}, Ref{Int32}, Ref{Int32}, Ptr{Int32}, Ptr{Int32}, Ref{Int32}, Ref{mc66_control{Float32}}, Ref{fa14_seed}, Ptr{Int32}, Ref{Int32}, Ptr{Int32}, Ptr{Int32} , Ptr{Int32}, Ref{Int32}, Ref{Float32}, Ref{Int32}), m , n , nz , irn , jcn , nblocks , control , seed , row_order , info , rowptr , column_order, colptr , netcut , rowdiff , kblocks ) end -function mc66s_print_message(info) - lp = Ref{Int32}(6) - wp = Ref{Int32}(6) - context = Ptr{Cvoid}() +function mc66s_print_message(info, control) + context = "" ccall((:__hsl_mc66_single_MOD_monet_print_message, libhsl_mc66), - Cvoid, - (Ref{Int32}, Ref{Int32}, Ref{Int32}, Cstring), - info , lp , wp , context) + Cvoid, + (Ref{Int32}, Ref{Int32}, Ref{Int32}, Ptr{UInt8}), + info , control.lp, control.wp, context ) end function mc66d(m, n, nz, irn, jcn, nblocks, control, seed, row_order, info, rowptr, column_order, colptr, netcut, rowdiff, kblocks) ccall((:__hsl_mc66_double_MOD_monet, libhsl_mc66), - Cvoid, + Cvoid, (Ref{Int32}, Ref{Int32}, Ref{Int32}, Ptr{Int32}, Ptr{Int32}, Ref{Int32}, Ref{mc66_control{Float64}}, Ref{fa14_seed}, Ptr{Int32}, Ref{Int32}, Ptr{Int32}, Ptr{Int32} , Ptr{Int32}, Ref{Int32}, Ref{Float64}, Ref{Int32}), m , n , nz , irn , jcn , nblocks , control , seed , row_order , info , rowptr , column_order, colptr , netcut , rowdiff , kblocks ) end function mc66d_print_message(info, control) - context = Ptr{Cvoid}() + context = "" ccall((:__hsl_mc66_double_MOD_monet_print_message, libhsl_mc66), - Cvoid, - (Ref{Int32}, Ref{Int32}, Ref{Int32}, Cstring), - info , control.lp, control.wp, context) + Cvoid, + (Ref{Int32}, Ref{Int32}, Ref{Int32}, Ptr{UInt8}), + info , control.lp, control.wp, context ) end """ @@ -95,6 +93,6 @@ function mc66(A::SparseMatrixCSC, nblocks::Integer) rowdiff = Ref{Float64}() kblocks = Ref{Cint}() mc66d(m, n, nz, irn, jcn, nblocks, control, seed, row_order, info, rowptr, column_order, colptr, netcut, rowdiff, kblocks) - mc66d_print_message(info[], control) + mc66d_print_message(info, control) return row_order, column_order end