Re: Compiling ESQL/C with C++?
Posted in 1993
I am/have been doing it for a while, but it is like swimming up stream. I believe Informix has no plans to provide an ESQLC++. They seem to be pushing 4GL++. First of all, the esql pre-processor appears to get very confused mixing $<commands> with all the {}() in C++ languages. So I gave up very early trying to anything but database, prepare, declare, open, fetch, free. You will need to prepare a .h file that declares all the Informix internal functions you use (e.g. void inqprep (...)). Finally, since informix declares cursor structures as static global variables, if you try to use cursors inside C++ objects (why else would you use C++), you quickly find that two instances of an object with a cursor fails as they use the same cursor. I over came this problem, by redeclaring the cursor structure within an object I call InformixTable and derived other objects from it. Esqlc 5.0 presented a bigger problem over 4.1, as the cursor structure change to pointers allocated by informix code. However, some additional kludges got it working also. In summary, I did the above as an exercise and I would not recommend it to someone on a schedule. Rather, it would be better to call standard esqlc code from C++.