Hi Stefan,
Holy crap! I apologize for the late night retardation. I pasted in some of
the code from the docs to kind of start over and neglected to tweak
everything. Anyway, here is the hopefully more correct version. Specifying
the return type got me past the initial problem, but I'm getting some grief
from ccall now in the form of to following:
ERROR: pointerref: invalid pointer type
in init_func at /build/compvia/src/pqvm/service_test.jl:17
while loading /build/compvia/src/pqvm/service_test.jl, in expression
starting on line 42
#typedef int (*pq_service_handler)(int *exit_flag, void *user_data);
#int pq_service_create (const char *name,
# const char *desc,
# pq_service_handler init_func,
# pq_service_handler service_func,
# void *user_data);
function init_func{Cint}(a_::Ptr{Cint}, b_::Ptr{Void})
a = unsafe_load(a_)
b = unsafe_load(b_)
return convert(Cint, 0)
end
const init_func_c = cfunction(init_func, Cint, (Ptr{Cint}, Ptr{Void}))
function service_func{Cint}(a_::Ptr{Cint}, b_::Ptr{Void})
a = unsafe_load(a_)
b = unsafe_load(b_)
while a == 0
sleep(1)
end
return convert(Cint, 0)
end
const service_func_c = cfunction(service_func, Cint, (Ptr{Cint}, Ptr{Void}))
ccall((:pq_service_create,
"/build/compvia/x86_linux_64/pqvm/libservice.so"),
Cint,
(Ptr{Uint8}, Ptr{Uint8}, Ptr{Void}, Ptr{Void}, Ptr{Void}),
"test_service", "test_service", init_func_c, service_func_c, C_NULL)
Thanks,
-G