Re: memory allocation under AIX 3.2
Posted in 1992
In article <9448@emory.mathcs.emory.edu> mm@ssf.pt (Manuel Monteiro) writes: > I have several ec functions similar to > > f(fgl_pcnt) > int fgl_pcnt; > { > ...; > char *x = malloc(...); /* x size is not known in compile time */ > > ...; /* calculates x value */ > > /* RETURN x */ > pushquote(x, strlen(x)); > doretalloc(1); > free( x ); /* must free x space before returning */ > return(1); > } There is a retquote() function (also retint, retdub, etc etc) for precisely this purpose -- it copies the value to the 4GL stack instead of merely pushing the pointer. In the 4GL 4.1 Supplement manual there is an extensive discussion of the C-to-4GL API and these functions are documented there.