Skip to content

Commit 1a127ff

Browse files
[julia, converter] Handle return type Int64 correctly for callbacks
1 parent 350f2e8 commit 1a127ff

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

lang_julia/OpenInterfaces/src/OpenInterfaces.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,15 @@ function _make_c_func_wrapper_over_jl_fn(
533533
return Int32(0)
534534
elseif typeof(result) == Int32
535535
return result
536+
elseif typeof(result) == Int64
537+
try
538+
return Int32(result)
539+
catch InexactError
540+
throw(
541+
"Return type of the callback is Int64 with value `result = $(result)` " *
542+
"and cannot be converted to 32-bit integer due to truncation",
543+
)
544+
end
536545
elseif typeof(result) == Float64
537546
return result
538547
else

0 commit comments

Comments
 (0)