Ok - I figured this out, but in doing so, I make this a poster child for automated wrapper generators: I missed some function arguments when I hand wrote the example. TL;DR the @ccall
parts should have referenced this.p::Ptr{Cvoid}
. I naively expected that an error would have been thrown for wrong arguments.
the longer version
--- julia_test.jl 2023-08-07 16:35:21.170275259 -0500
+++ julia_test.jl.ori 2023-08-07 16:34:55.630275688 -0500
@@ -15,13 +15,13 @@
function Base.getproperty(this::MainApp, s::Symbol)
if s == :borrowA
function()
- ah = @ccall "libstuff_wrapper.so".MainApp_borrow_A(this.p::Ptr{Cvoid})::Ptr{Cvoid}
+ ah = @ccall "libstuff_wrapper.so".MainApp_borrow_A()::Ptr{Cvoid}
@show ah
A(ah)
end
elseif s == :borrowB
function()
- B(@ccall "libstuff_wrapper.so".MainApp_borrow_B(this.p::Ptr{Cvoid})::Ptr{Cvoid})
+ B(@ccall "libstuff_wrapper.so".MainApp_borrow_B()::Ptr{Cvoid})
end
else
getfield(this, s)
@@ -42,7 +42,7 @@
@show s
if s == :get_id
function()
- @ccall "libstuff_wrapper.so".A_get_id(this.p::Ptr{Cvoid})::Cint
+ @ccall "libstuff_wrapper.so".A_get_id()::Cint
end
else
getfield(this, s)
@@ -62,7 +62,7 @@
function Base.getproperty(this::B, s::Symbol)
if s == :get_s
function()
- @ccall "libstuff_wrapper.so".B_get_s(this.p::Ptr{Cvoid})::Cdouble
+ @ccall "libstuff_wrapper.so".B_get_s()::Cdouble
end
else
getfield(this, s)