Using function_ptr for shape function - weird calling semantic

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
1 post • Page 1 of 1
flindecke
Posts:69
Joined: Wed Jun 24, 2015 1:54 pm

Using function_ptr for shape function - weird calling semantic

Post by flindecke »

Suppose we have a shape or panel "bar" providing a scope defined function "theFunction(...)".

I normally call this function as following

Code: Select all

shape sut = getShape("bar");
invokeMethod(sut, "theFunction", ...);
or

Code: Select all

shape sut = getShape("bar");
sut.theFunction(...);
Now we are able to use function_ptr

Code: Select all

shape sut = getShape("bar");
function_ptr sutTheFunction = sut.theFunction;
callFunction(sutTheFunction, ...);
My problem is, that using this function pointer from another shape "foo", the function "theFunction" called via function_ptr is not able to find any scope lib defined variables of shape/panel "bar" anymore.
Furthermore it seems to be, that it will find variable from the caller shape "foo".

My expectation is, that the function "theFunction" called via function_ptr uses the callee's context and not the caller's one.

Is this the intended calling semantic?

Best regards,
Frank

1 post • Page 1 of 1