home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!sol.ctr.columbia.edu!emory!ssf.pt
- From: mm@ssf.pt (Manuel Monteiro)
- Newsgroups: comp.databases.informix
- Subject: memory allocation under AIX 3.2
- Message-ID: <9448@emory.mathcs.emory.edu>
- Date: 2 Sep 92 03:58:04 GMT
- Sender: walt@mathcs.emory.edu
- Reply-To: mm@ssf.pt (Manuel Monteiro)
- Lines: 53
- X-Informix-List-ID: <list.1423>
-
- Hi Informix AIX gurus,
-
- I had the following problem when upgrading from AIX 3.1 to AIX 3.2.
-
- In a esql/c program, when you pushquote((char *)str, strlen(str)),
- what is really pushed into the stack is the pointer to the string, not
- the contents of the string (I didn't know that 'call by reference' was
- supported :-).
-
- With AIX 3.2 when you 'free' a block, previously allocated using
- 'malloc', its contents are destroyed. With AIX 3.1 its contents were
- left undisturbed.
-
- 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);
- }
-
- To be called from 4GL programs
-
- CALL f() RETURNING str
-
- The problem is that the pointer pushed into the stack now points to a
- 'destroyed' block, no longer containing the values I want.
-
- Does anyone out there knows how to solve this problem (without
- rewriting all those functions :-(?
- Is there a port to AIX 3.2 that really copies the strings to the stack?
-
- BTW: I'm running INFORMIX-4GL Version 4.10.UD2 on a IBM RISC 6000/530
-
- Thx.
-
- mm
- -------------------------------------------------------------------------------
- | Manuel Figueiredo Monteiro |
- | S.S.F. - Servicos de Software Financeiro, Lda VOICE: +351 (1) 727-0303 |
- | Estrada da Luz, No 104 - Loja A FAX: +351 (1) 727-0335 |
- | 1600 Lisboa E-MAIL: mm@ssf.pt |
- | PORTUGAL |
- -------------------------------------------------------------------------------
-