home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.databases.oracle
- From: raph@panache.demon.co.uk (Raphael mankin)
- Path: sparky!uunet!pipex!demon!panache.demon.co.uk!raph
- Subject: Re: Pro*C / C++ ??
- Distribution: world
- References: <145384@lll-winken.LLNL.GOV>
- Organization: Solvfield Ltd.
- Reply-To: raph@panache.demon.co.uk
- X-Mailer: Simple NEWS 1.90 (ka9q DIS 1.19)
- Lines: 41
- Date: Fri, 8 Jan 1993 20:09:07 +0000
- Message-ID: <726523747snz@panache.demon.co.uk>
- Sender: usenet@demon.co.uk
-
- In article <145384@lll-winken.LLNL.GOV> hudek@polaris.llnl.gov writes:
-
- ><||>
- >
- >Question about Oracle's Pro*C precompiler:
- >
- >As I understand it and from a quick look at some output, this simply takes
- >source code statements that start with a key phrase (EXEC SQL...) and
- >translates them into C code and Oracle system calls.
- >
- >Given that, is there any reason why the output of Pro*C couldn't then be
- >run through Sun's C++ compiler and produce good executables? (since the
- >C++ compiler can obviously handle straight C code).
- >
-
- Yes you can embed SQL in C++. There are minor caveats.
-
- 1. Function arguments and class members cannot be SQL variables (within a
- DECLARE SECTION).
-
- 2. ProC does not understand // comments.
-
- 3. ProC generates things like:
- struct sqlca sqlca;
- which causes a name conflict in C++. You have to run a ``sed'' script over
- the generated C++ to substitute some of the names.
-
- 4. You will have to include in every module, probably in a header file, a whole
- raft of declarations of the form:
- extern "C" void sqlxyz(...);
- to link the Oracle library.
-
- 5. You _may_ have trouble with the AT&T C++ compiler. It compiles and links
- fine, but with some versions the code hangs when you connect to the DB.
- g++ is OK, as are newer versions of AT&T.
-
- 6. Be sure to have a DECLARE SECTION in file scope before any functions in
- each file. This is true for C as well. Otherwise some things will be
- declared in the wrong scope.
- --------------
- Raphael Mankin Nil taurus excretum
-