Oracle library issue in child process

Hi,
I am using a daemon from which I am forking 3 processes
P1,P2,P3 out of which P3 is compiled with oracle lib32/libclntsh.so and P1,P2 are non database process.
The Logic of daemon is that if any one goes down simply clean the other and refork all the 3 again.
P3 is getting forked first time without any problem.But when second time by daemon it is showing ...
"ld.so.1: cp_proc: fatal: libwtc9.so: open failed: No such file or directory" error and not coming up.

I guess there is some guffup with the environment variable(like LD_LIBRARY_PATH) which is not available to P3 second time when it tries to come up.

I tried hard l but to no avail !!

Please suggest any expert opinion !!!
compiler:gcc(32 bit) library(32 bit) sparc SUNW,Sun-Fire-V240

My first question would be - are you calling EXEC SQL rollback release; in P3 or are you passing a connection (session) object from the master process?

Try:

ldd <P3filename>  | grep libwtc9

if libtwc shows up in the ldd display it is not an LD_LIBRARY_PATH kind of problem.