Louis M
unread,Jun 15, 2020, 10:59:15 AM6/15/20Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Eiffel Users
Hello everyone.
I try to use an external method in the {C_EXTERNAL} class like this:
frozen method_name(a_object:POINTER):POINTER
external
"C++ inline use <Box2D.h>"
alias
"((CType *)$a_object)->functionName()"
end
in an agent call. I define the {FUNCTION} variable like this:
l_method:FUNCTION[POINTER, POINTER]
Finally, I assign the agent like this:
l_method := agent {C_EXTERNAL}.method_name
When I compile that, I have a VUAR error saying that the type of the
agent is:
FUNCTION [C_EXTERNAL, POINTER, POINTER]
instead of :
FUNCTION [POINTER, POINTER]
Since it is a class method, I don't have an object of type {C_EXTERNAL}
to use in the agent call. I have a workaround using:
l_method := agent (a_item:POINTER):POINTER do Result :=
{C_EXTERNAL}.method_name(a_item) end
But I think that this is ugly (particularly when used as method
argument). So is there a way to use a more concise technique of creating
an agent from external or class method?
Thanks a lot,
Louis M