[DGD] segmentation fault during compile_object

bart at wotf.org bart at wotf.org
Wed Aug 14 14:45:04 CEST 2013


> I forget (or maybe I never looked), were they actually just
> dispatch-by-name with a bit of window dressing? I half-remember
> thinking that was all that should be needed to properly implement
> function pointers in LPC: some decorations for dispatch-by-name, 
> since dispatch-by-name basically does most of what would be expected 
> of function pointers.

Its an lwo that stores object, function name and optional arguments. On call it adds optional 
extra arguments to the argument list and then essentially does a call_other( obj, function, 
args...)

Funcionally it can be completely simulated in lpc as you suggest, and for example sys/lib/
menu.c in gurbalib does most of this (through it doesn't support adding extra arguments at 
call time, that would be trivial to add). The only real differences are syntax and compile time 
type checking.. oh, and that the implementation in menu.c allows making a 'function pointer' 
for functions in other objects. The compile time type checking could be done as well but 
was a bit too involved for what that menu.c code needs.

'Real' function pointers could point at a specific object.program.function instead, but imo 
that wouldn't be a good idea for lpc.

Bart
--
http://www.flickr.com/photos/mrobjective/
http://www.om-d.org/




More information about the DGD mailing list