Re: putenv for AIX and ifdef for AIX ClownPleco wrote:
> I have read several posts about putenv is not Standard C. But I'm
> wondering if anyone knows if it is available in AIX. All of our other
> platforms (linux (32 and 64 bit), sgi, hpux, x86, darwin (intel and
> mac), interix and sun) behave properly for our application. We found
> that if we run this command prior to running the application, it works
> correctly:
>
> set LDR_CNTRL=MAXDATA=0x80000000;export LDR_CNTRL
>
> Our problem is that we start a parent process that spawns the child
> application. If we set the LDR_CNTRL=MAXDATA prior to starting the
> parent process, other child applications are failing.
>
> Our initial solution is to have wrap around child application that
> sets the environmental variable and then spawns an additional child.
> This environmental variable would only be set if the the operating
> system is AIX.
>
> Second question, does anyone know the correct #ifdef statement to
> check for AIX, is it:
>
> #ifdef __AIX__
>
> I'm a very very green C programmer!
>
> Thanks
>
> Rick
>
putenv() does exist for AIX.
See /usr/include/stdlib.h and:
nm /usr/lib/libc.a | grep putenv
As for the #ifdef, it may depend on which compiler you are using.
For example the IBM Visual Age C compiler will define some
symbols based on the /etc/vac.cfg file, which has symbols like
_AIX, _AIX53, etc.
You could '#include <standards.h>' and use one of the _AIX*
symbols which are defined in /usr/include/standards.h or you
could modify your Makefile to use the compiler flag '-D__AIX__'.
Paul Landay |