kentb@tekchips.UUCP (Kent Beck) (07/11/85)
I seem to be having problems calling OpenPort with dynamically allocated
storage from MegaMax C v2.0. A short example is:
#include <qd.h>
main()
{
GrafPtr p,q,r;
GrafPort s;
printf("Allocating port, sizeof(GrafPort) = %d\n", sizeof(GrafPort));
p = (GrafPtr) NewPtr(sizeof(GrafPort)); /* or malloc(...) */
GetPort(&q);
printf("Got the old port\n");
r = &s;
OpenPort(r);
Move(10,110); /* So the next printf will show up */
printf("Opened the first port\n");
/* OpenPort(p); When these statments are executed this bombs...
printf("Opened the second port\n");*/
SetPort(q);
printf("Port reset\n");
}
Any ideas? Thanks in advance.
Kent Beck
Tektronix, Inc
PO Box 500, MS 50-662
Beaverton, OR 97077
503/627-6172
usenet: {allegra|decvax}!tektronix!tekchips!kentb
CSNet: kentb%tekchips@tektronix.csnet