From: Satish Balay (balay_at_mcs.anl.gov)
Date: Wed Apr 03 2002 - 20:09:24 BST
The reason it works for you - and not for me is - in your case - the source is combined into one source file - hence main() routine is able to access the 'struct _p_Vec' info. In the example code I sugested, the code is split into multiple files - (as indicated in my last mail). In this case - it doesn't work from main() routine. Thanks, Satish On Wed, 3 Apr 2002, Rod Armstrong wrote: > This seemed fine for me. I used 3.37-beta5 on: > > ---------------------------------------------------------------------- > typedef struct _p_Vec* Vec; > struct _p_Vec { > int a[10]; > char *type; > }; > > VecCreate(Vec *v) > { > *v= (Vec)malloc(sizeof(struct _p_Vec )); > } > > main(void) > { > Vec v; > VecCreate(&v); > v = 0; > } > ---------------------------------------------------------------------- > > After the malloc in VecCreate, ups displyed: > > Functions > main v2.c:15 > struct _p_Vec <v{0}> *0x205d0 > int <a[0]> 0 > char <type{0}> *NULL > VecCreate v2.c:10 > struct _p_Vec <v{0}{0}> *0x205d0 > int <a[0]> 0 > char <type{0}> *NULL > > > I tried this on Solaris 2.5 and 8, with gcc 2.8.1, clcc and SunPro cc; > also gcc 2.7.2.3 on Debian 2.0.34. > > Rod > >
This archive was generated by hypermail 2.1.4 : Thu May 23 2002 - 15:54:05 BST