Everything's alright up to this point, including your definition of
return_a_value
. That's how you may call the function:
(with-foreign-object (arg 'example)
(setf (foreign-slot-value arg 'example 'number) 123)
(return-a-value arg)
(foreign-slot-value arg 'example 'number))