Function pointers for methods
BlitzMax Forums/OpenGL Module/Function pointers for methods
| ||
Type Tight Method Action() Print "Action packed!" End Method End Type Local WhatIsIt() ItIs:Tight = New Tight WhatIsIt = ItIs.Action WhatIsIt() WaitKey() End How do i get a function pointer to work for Methods..please tell me there's a way. |
| ||
Oops, wrong forum..sorry guys. if you have the answers..feel free to reply :). |
| ||
You can't. |
| ||
You would need to do it this way:Type Tight function ActionWrap(entity:object) Tight(entity).Action end function Method Action() Print "Action packed!" End Method End Type Local WhatIsIt(entity:object) ItIs:Tight = New Tight WhatIsIt = Tight.ActionWrap WhatIsIt(ItIs) WaitKey() End |
| ||
yeah, i see. I don't think that'll due though. I'll have to create wraps of all my functions then..or least ones i think i want pointers to work for. People mention the program will crash if you nullify the object ref and the fnc pointer is called..i don't see what the big deal is..just keep up with it in code or else. |
| ||
The problem is that it would become far slower to track method pointers for all methods as well not only the ref counter for the object itself. (actually not even this is fully implemented as no root references exist) |