ACS19@UHUPVM1.BITNET (07/19/86)
While trying to compile a program using Megamax C (ported from DRI C) with type casting changes (coercion -- a real pain). The problem seems to be with a pointer to a function. For example: long (* ptr)() . . code . return ((*ptr)(var1,var2,var3)) When it gets to this point, returning the result of the jump thru the pointer to the function, it blows up. I could do this in assembly and insert it, but that is a pain... Any answers, comments. Thanks, Mike
djb@riccb.UUCP (Dave J. Burris ) (07/31/86)
> While trying to compile a program using Megamax C (ported from DRI C) with > type casting changes (coercion -- a real pain). The problem seems to be with > a pointer to a function. For example: > > long (* ptr)() > . > . code > . > return ((*ptr)(var1,var2,var3)) > > When it gets to this point, returning the result of the jump thru the pointer > to the function, it blows up. I could do this in assembly and insert it, but > that is a pain... > Any answers, comments. > > Thanks, Mike Well, this works with Megamax. This code changes the interrupt vector for the MIDI receiver. VOID jvec(); long sys_vector; main() { register long *int_ptr; int_ptr = (long *) Kbdvbase(); /* get the vector base */ sys_vector = *int_ptr; /* get old value to restore */ *int_ptr = (long) jvec; /* set new vector */ /* other code here */ *int_ptr = sys_vector; /* restore old vector */ } -- Dave Burris ..!ihnp4!ihopa!riccb!djb Rockwell Switching Systems, Downers Grove, Il.