Yeah, the code is a nightmare. It was Win32 COM application, and at some point people decided to port it to linux. Instead of rewriting code, they have written some classes and macros to imitate COM behaviour (hiding unix functions inside). It is now really a mess and company I am working in, takes it over subsystem after subsystem and tries to clean it up...