Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!apple!bionet!ucselx!crash!kevin@crash.cts.com From: kevin@crash.cts.com (Kevin Hill) Newsgroups: comp.sys.mac.programmer Subject: Returning Addresses from functions Message-ID: <7984@crash.cts.com> Date: 14 Mar 91 03:49:43 GMT Sender: root@crash.cts.com Lines: 46 I wish to create functions that return a pointer to a memory location. Similar to malloc. However, whenever the calling function is not in the same file as the pointer returning function, the address returned is only 4 bytes long. I.e. if the address was originally Actual Returned 0x1D1DFFFF 0x0000FFFF 0x3F175432 0x00005432 it seems that only 4 bytes are returning from the function when it is another .c file. HOWEVER, when the calling function and the function itself are in the same .c file, there is not a problem.. The addresses are returned correctly... Any ideas?? I am using The latest version of Think C 3.xxx (Yes I know Think C 4.0 is out, but I am a college student and $60 buys a lot of beer :) ) Here is a copy of the function that is returning the address. struct hub { Point point; struct hub *next; }; typedef struct hub Hub, *HubPtr, **HubHandle; HubPtr cur_bhub(hub,flag) HubPtr hub; int flag; { static HubPtr beg_hub; if (flag != 0) beg_hub = NULL; if (hub != NULL) beg_hub = hub; return(beg_hub); } Thank you in advance -Kevin