Skip to content

Commit

Permalink
use unsafe_convert instead of cconvert to ensure handles aren't GCed …
Browse files Browse the repository at this point in the history
…during ccall (#482)
  • Loading branch information
simonbyrne authored Jul 13, 2021
1 parent 68545ed commit b623eb5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/handle.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ macro mpi_handle(def, mpiname=nothing, extrafields...)

# allows us to pass XX objects directly into MPI_XX ccall signatures
function Base.cconvert(::Type{$mpiname}, obj::$name)
obj
end
function Base.unsafe_convert(::Type{$mpiname}, obj::$name)
obj.val
end
# allows us to pass XX objects directly into Ptr{MPI_XX} ccall signatures
Expand Down

0 comments on commit b623eb5

Please sign in to comment.