Re: Informix CLI and C++ on Unix
Posted in 1997
Hi, I am not using ESQL. I am using the CLI library (Informix ODBC equivalent) that came with Informix 7.22. We use ESQL here with C++ and it works just fine. But I am looking into using the CLI library and I get a bus error with C++. Actually, Informix tech support changed its mind and decided that the CLI library should work with C++, so they have filed a bug report. Thanks, Uday ---- Jonathan Leffler wrote: } } >Date: Thu, 07 Aug 1997 16:16:46 -0400 } >From: Uday Shankar <uday@dpg.rnb.com> } >X-Informix-List-Id: <list.15856> } > } >Has anyone tried using Informix CLI (the one which comes } >with Informix 7.22) on the Unix platform from a C++ program ? } > } >When I use it from a C program, it works fine, but when I } >compiled a C++ program on a Sun platform (I tried using } >the GNU g++, the Sun Sparcworks and the CC compilers), I } >go a bus error when I attempted to run the program. } > } >After much experimentation, I finally discovered that if I } >have any references to cout or any stream operator in } >my program, I get a bus error. This happens even if I } >don't have any references to any Informix CLI or ESQL variables } >or functions in my program. All I do is link with the Informix } >CLI libraries. } } Earlier this week, I posted an updated version of the ESQL/C and C++ } headers, compilation script, etc which I use when I need to mix C++ and } ESQL/C. When I previously compiled the test code with that material (7th } July), I was using 7.22.UC1 ESQL/C and GCC 2.7.2.2. I recompiled it today } using ESQL/C 7.23.UC1 and both SUNWspro C++ compiler SC4.2 and GCC 2.7.2.2, } it also worked fine. The test code uses cout both before and after } database access. } } So, yes, it can be done. } } >Has anyone seen this behavior too ? } } No. } } >Does anyone have any workarounds ? } } Use the stuff I provide to do the job? It may or may not work for you. } } >I called Informix support, but they weren't of much help since } >they said that this product was intended to be used in C programs } >only and since I was attempting to use it in C++, it was in } >effect, unsupported! } } Strictly, they are correct. That's one reason why there are the caveats in } the code I provide. Soon, they will be out of date; a near-future version } (7.24 as I understand it, but subject to change) will have more direct C++ } support, including .ecpp files for C++ code with embedded ESQL/C material. } This probably won't be a full ESQL/C++, so you probably won't be able to } use classes and member functions and so on in the ESQL/C statements. But } at least the compilation should be smooth and automatic (and only a few } years behind the times!). } } Yours, } Jonathan Leffler (johnl@informix.com) #include <disclaimer.h> } PS: Warning I do not reply to messages with anti-spam in the return path. -- Uday Shankar Derivative Products Group Republic National Bank of New York uday@dpg.rnb.com (212) 525-8000