CompuServe Thread

Forum unknown · Programming

#Manx help

5 messages in this thread
#36849From: Dan LotockyOct 20, 1986 10:54 PM
This problem may be particular to the Manx C compiler. I'm trying to allocate bitplanes using AllocRaster and FreeRaster but keep crashing the system. I have made a test program to isolate the problem: GfxBase=OpenLibrary("graphics.library",0l); FreeRaster(AllocRaster(320l,200l),320l,200l); (I've left out the rest of the bookkeeping) Can anybody verify this problem and offer suggestions?
#36862From: Ray LarsonOct 21, 1986 12:15 AM
Be sure that you declare AllocRaster as returning void (a generalized pointer) and cast it to what you need (i.e. PLANEPTR), otherwise the compiler believes that it is returning an integer, and BOOM when you try to use it.
#36862From: Ray LarsonOct 21, 1986 12:15 AM
Be sure that you declare AllocRaster as returning void (a generalized pointer) and cast it to what you need (i.e. PLANEPTR), otherwise the compiler believes that it is returning an integer, and BOOM when you try to use it.
#36887From: Dan MooreOct 21, 1986 12:36 PM
Try including functions.h. It properly types the external functions so that the compiler knows that AllocRaster returns a pointer not an int. (Lattice lets you get away with a bad call since ints are 32 bits. Technically calling AllocRaster without declaring it as returning a pointer is an error. (Lint will yell at you about it.))
#36887From: Dan MooreOct 21, 1986 12:36 PM
Try including functions.h. It properly types the external functions so that the compiler knows that AllocRaster returns a pointer not an int. (Lattice lets you get away with a bad call since ints are 32 bits. Technically calling AllocRaster without declaring it as returning a pointer is an error. (Lint will yell at you about it.))