Friday, 31 July 2009

Never use Global Variables.....

So I found the issue with the Postgres calls. Nothing to do with Postgres; everything to do with my lack of programming skills.

For whatever reason, I had quite a lot of globally-declared variables in my program, one of which was "char poll[3] = {0x00 0x30 0x26}"

Now, it just so happened that "int poll" is declared through the libpq-fe.h header used for the PQlib interface to Postgres. Result ? Segmentation Fault.

Memo to self: next time, use namespaces.

0 comments:

Post a Comment