While i can't help you directly with your problem (stopped programming way too long ago and never did it under AIX) here are some general pointers which might help you:
Try the AIX programmers reference offered at the Max Planck Institute for Solid State Research, Stuttgart:
AIX Documentation: Programmer's Reference
It is for AIX 5.2, which might not be the release you are using, but maybe the problem is not version-dependent.
You may know the standard debugger "dbx", but you might not know the kernel debugger "kdb". Beware, though! This is a quite dangerous tool, you could easily crash the machine.
Lastly, we have a special forum for High-Level Programming in Unix environments. You might want to pass this thread over to there. Give me (any mod) a short note if you want to do this.
I hope this helps.
bakunin