I want a C routine, which is supplied with an Eiffel 'agent' to call the routine 'apply' in the class PROCEDURE.
int c_nng_aio_set_procedure_target(void *item, EIF_OBJECT target) {
void **pptr = (void **) (item);
EIF_TYPE_ID type_id; /* Eiffel type identifier for class `class_name' */
EIF_PROCEDURE e_proc; /* Eiffel procedure `proc_name' */
EIF_PROCEDURE *p_proc;
EIF_OBJECT *p_object;
type_id = eif_type (target);
if (type_id == EIF_NO_TYPE) {
printf ("PROCEDURE type_id not found\n");
return (0);
}
e_proc = eif_procedure ("apply", type_id);
if (e_proc == (EIF_PROCEDURE) 0) {
printf ("'apply' procedure not found\n");
return (0);
}
/* Success in finding procedure address, */
/* now store that and the target into the storage block */
pptr[4] = e_proc;
pptr[5] = target;
return (1);
}
My code currently prints [as above] that the 'apply' procedure is not found.
I have ensured that 'apply' is used from within the Eiffel code [apply_check is called]:
report_completion
do
print ("report_completion ... OK%N")
end
apply_check
local
p: PROCEDURE
do
p := agent report_completion
p.apply
end
Any ideas ?