4 messages in com.mysql.lists.plusplusStrange interaction problem with mysq...| From | Sent On | Attachments |
|---|---|---|
| Earl Miles | 26 Oct 2004 16:44 | .cpp |
| Chris Frey | 28 Oct 2004 20:29 | |
| Earl Miles | 17 Nov 2004 09:20 | |
| Warren Young | 17 Nov 2004 16:47 |
| Subject: | Strange interaction problem with mysql++ and net-snmp![]() |
|---|---|
| From: | Earl Miles (mer...@logrus.com) |
| Date: | 10/26/2004 04:44:33 PM |
| List: | com.mysql.lists.plusplus |
| Attachments: |
I have a program that is to use both MySQL++ and Net-SNMP. While using them both alone, everything seems to run perfectly well, but when I put them together I get some odd interaction problems.
If I open an SQL connection before I initialize SNMP, any query I run on that connection will throw an exception but there is no error message or mysql errno. This only occurs if I create the Connection object with the new operator; if I create it on the stack, this doesn't happen and everything works fine. So far. My actual program has been modified to make the Connection be created on the stack, but I don't particularly like it, given the way that code is structured.
If I initialize SNMP first, and then open the connection object, I get coredumps in the net-snmp library when it tries to malloc().
I've managed to isolate this into a small test program. I rewrote the test program to use just mysql without the C++ API to see if I could duplicate the problem, and I cannot, which is why I'm checking with this list first to see if anybody has either a) run into this before, or b) understands the mysql++ library well enough to have any idea where to even look next for what this problem might be.
This one's got me stumped. This would be easier to trace if I could understand the nature of the problem a little better. With MySQL not returning any kind of error message, I don't have any insight as to what exactly is going wrong. This is where I'm really hoping someone will have some ideas.
I'm running on a pretty stock RedHat 9.0 server with 1.7.19 MySQL++, mysql-3.23.58-1.9 from RPM, and net-snmp-5.1.1 from tar. Oh, and gcc-3.2.2-5.
I've attached the testfile that can make this fail (which includes an #ifdef as kind of a comment; the top one, using the new operator fails, the bottom one doesn't). The query included is arbitrary, I have yet to find a query to run that doesn't fail, so when compiling anyone can just fill in values from a database that happens to be handy. Here's the quick and dirty line I'm using to compile it:
g++ -g -O2 -o testprog test.cpp `net-snmp-config --libs` -L/usr/lib/mysql -lmysqlclient -lmysqlpp -I/usr/include/mysql++ -I/usr/include/mysql -I/usr/local/include -Wno-deprecated





.cpp