Skip to content

Commit b623eb5

Browse files
authored
use unsafe_convert instead of cconvert to ensure handles aren't GCed during ccall (#482)
1 parent 68545ed commit b623eb5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/handle.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ macro mpi_handle(def, mpiname=nothing, extrafields...)
3232

3333
# allows us to pass XX objects directly into MPI_XX ccall signatures
3434
function Base.cconvert(::Type{$mpiname}, obj::$name)
35+
obj
36+
end
37+
function Base.unsafe_convert(::Type{$mpiname}, obj::$name)
3538
obj.val
3639
end
3740
# allows us to pass XX objects directly into Ptr{MPI_XX} ccall signatures

0 commit comments

Comments
 (0)