Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Peter Hofmann — — source: Informix-list mailing list archive (1991-1998)
}
} I would like to know if anybody has any experience/success writing
} embedded SQL statements inside a C++ program.
We have done a project using C++ (gcc 2.2.2.) und ESQL/C. Both work
together fine, you should only expect occasional warnings that you can
ignore.
}
} We have an Informix database and a ESQL pre-processor meant
} for C. According to the local agent from Informix, the SQL
} pre-processor works only on C files, not C++ files.
} We intend to use GCC as our C++ compiler, but we do not know
} how to make the pre-processor work with GCC.
}
} Is there any way to work around the abovementioned problem?
}
Instead of calling the esqlc-Script we used the preprocessor directly.
Here is an excerpt from our makefile:
.SUFFIXES:
.SUFFIXES: .ec .o .cc .h
.ec.cc:
/usr/informix/lib/esqlc -icheck -t unix $*.ec;
mv $*.c $*.cc
.cc.o:
gcc $(EXTRA_DEFINES) $(CC_OPTIONS) $(INCLUDEFILES) -c $*.cc
The .ec.cc rule makes a .cc-File from a .ec-File using the ESQL/C-preprocessor.
The .cc.o rule than produces the object file.
test.o: test.cc
test.cc: test.ec
The above line is necessary, because test.cc may not exist initially und make
is unable to chain two rules together.
test: test.o
gcc -o test test.o /usr/informix/lib/libsql.a
For the linking pass the sql-Library must be included.
I hope this works for you too.
--
Peter Hofmann e-mail: peterh@prz.tu-berlin.de
Technical University Berlin
Einsteinufer 17 Tel. ++49-(0)30-314-21292
W-1000 Berlin 10 -22612
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.