home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / database / informix / 1860 < prev    next >
Encoding:
Internet Message Format  |  1992-09-01  |  2.1 KB

  1. Path: sparky!uunet!usc!sol.ctr.columbia.edu!emory!ssf.pt
  2. From: mm@ssf.pt (Manuel Monteiro)
  3. Newsgroups: comp.databases.informix
  4. Subject: memory allocation under AIX 3.2
  5. Message-ID: <9448@emory.mathcs.emory.edu>
  6. Date: 2 Sep 92 03:58:04 GMT
  7. Sender: walt@mathcs.emory.edu
  8. Reply-To: mm@ssf.pt (Manuel Monteiro)
  9. Lines: 53
  10. X-Informix-List-ID: <list.1423>
  11.  
  12. Hi Informix AIX gurus,
  13.  
  14. I had the following problem when upgrading from AIX 3.1 to AIX 3.2.
  15.  
  16. In a esql/c program, when you pushquote((char *)str, strlen(str)),
  17. what is really pushed into the stack is the pointer to the string, not
  18. the contents of the string (I didn't know that 'call by reference' was
  19. supported :-).
  20.  
  21. With AIX 3.2 when you 'free' a block, previously allocated using
  22. 'malloc', its contents are destroyed. With AIX 3.1 its contents were
  23. left undisturbed.
  24.  
  25. I have several ec functions similar to
  26.  
  27. f(fgl_pcnt)
  28.      int fgl_pcnt;
  29. {
  30.   ...;
  31.   char *x = malloc(...);        /* x size is not known in compile time */
  32.   
  33.   ...;                          /* calculates x value */
  34.   
  35.   /* RETURN x */
  36.   pushquote(x, strlen(x));
  37.   doretalloc(1);
  38.   free( x );                    /* must free x space before returning */
  39.   return(1);
  40. }
  41.  
  42. To be called from 4GL programs
  43.  
  44.     CALL f() RETURNING str
  45.  
  46. The problem is that the pointer pushed into the stack now points to a
  47. 'destroyed' block, no longer containing the values I want.
  48.  
  49. Does anyone out there knows how to solve this problem (without
  50. rewriting all those functions :-(?
  51. Is there a port to AIX 3.2 that really copies the strings to the stack?
  52.  
  53. BTW: I'm running INFORMIX-4GL Version 4.10.UD2 on a IBM RISC 6000/530
  54.  
  55. Thx.
  56.  
  57. mm
  58. -------------------------------------------------------------------------------
  59. | Manuel Figueiredo Monteiro                                                  |
  60. | S.S.F. - Servicos de Software Financeiro, Lda     VOICE: +351 (1) 727-0303  |
  61. | Estrada da Luz, No 104 - Loja A                   FAX:   +351 (1) 727-0335  |
  62. | 1600 Lisboa                                       E-MAIL: mm@ssf.pt         |
  63. | PORTUGAL                                                                    |
  64. -------------------------------------------------------------------------------
  65.