Document ID: 11466.1
Subject: C++ POLICY AND DIRECTIONS
Last Modified: 24 January 1997
Author: Pamela Rothman
o Pro*C V1.3
----------
Generally speaking, Version 1.3 of Oracle Pro*C Precompilers do not
support embedded SQL in native C++ programs. This is due to 2 factors:
(1) Pro*C V1.3 is not capable of processing all C++
syntax, and thus will not accept all C++ source
program files, and
(2) On most ports, Pro*C V1.3 generates C code according
to the Kernighan and Ritchie (K&R) C standard,
whereas C++ compilers require C code compliance with
the ANSI C standard. C++ is a superset of ANSI C.
While some C++ compilers will accept both K&R and ANSI C code, there are
often other limitations which prevent users from successfully precompiling,
compiling, and linking embedded SQL in C++ executables. For example, the
libraries distributed with a given C++ compiler may not be compatible with
the Oracle libraries required to produce an executable.
For this reason, use of Pro*C V1.3 with C++ compilers is not recommended
and not officially supported.
Having said that, let us review the ways that our programmatic interface
products may be used in conjunction with C++ compilers.
First and foremost, the Oracle Call Interface (OCI) *can* be used in the
development of C++ applications - we are not aware of any limitations at all on
their use.
Secondly, Pro*C V1.3 can be used to implement database access in mixed C and C++
applications, if the following strategy is used:
- encapsulate database access routines (using embedded SQL
and requiring the Pro*C Precompiler) written in pure C
in separate modules from those that perform the application
logic in C++, and design a function call interface to them,
- precompile, C-compile, and link the database access modules in
the usual manner, and then
- link the resulting object code with other, C++ object modules,
producing the executable.
Our experience has shown that isolating and modularizing the database access
code in separate modules is beneficial anyway, and hence this technique should
prove to be unobtrusive.
The Desktop Products group, in an independent effort, is looking at the
issue of supporting the Borland C++ compiler, by implementing some changes
in Pro*C for their platform. Contact INFOPC or HELPPC for more information on
their activities.
Thirdly, our current releases of Pro*C and our future plans are discussed
below.
o Pro*C V1.4, V1.5, and V1.6
--------------------------
Presently, we have three versions of Pro*C that are production. Pro*C V1.4 is
bundled with Version 6 of Oracle, Pro*C V1.5 which is bundled with release 7.0
of Oracle7, and Pro*C V1.6 which is bundled with release 7.1 of Oracle7. The
code generated by Pro*C V1.4, V1.5, and V1.6 when used with Code=ANSI option,
is ANSI-compliant. This output can be compiled using C++ compilers. Our
developers have made an effort to ensure that release 1.5.10/1.4.15 can be used
with C++. Testing was done using a Gnu C++ (non-commercial) compiler. Since
no further internal testing will be performed using Pro*C V1.x, C++ is not
officially supported with version 1.x. However, customers have successfully
gotten it to work with C++ by modifying some of the code generated by Pro*C.
Note that the above strategy for using PRO*C 1.3 with C++ applies here too.
o Pro*C V2.0
----------
We had planned to offer compatibility with C++ in Version 2.0 of Pro*C;
however, this effort was cancelled, and we are looking to our object-
oriented DBMS research to yield products supporting C++ and other object
development languages.
In addition, Pro*C 2.0, which is released with Oracle 7.1, cannot process C++
input files. Pro*C 2.0 parses the input files and only understands C grammar.
For customers using C++, we have released Pro*C 1.6 with release 7.1 of Oracle.
Version 2.0 is a complete re-write of the Precompiler, specifically to support
extended capabilities like Precompiler recognition of #DEFINE directives, and
use of structure and structure member references in embedded SQL statements.
It is available with the 7.1 release of Oracle7 and does not support C++.
o Pro*C V2.1
----------
We are planning to officially support C++ in Pro*C 2.1 which will be released
with Oracle 7.2. Pro*C 2.1 still does not understand C++ code, but it will
have a new precompiler option PARSE. This option allows parsing to be turned
off so that the precompiler behaves like Pro*C 1.x. Note that if parsing is
turned off, a declare section is required just like in Pro*C 1.x. The PARSE
option will be documented in the Programmer's Guide to the Oracle Pro*C/C++
Precompiler Release 2.1.
o Future Plans
------------
Future plans include bringing further C++ support to Oracle's Pro*C.
We are working on object-oriented extensions to Oracle's RDBMS in
accordance with the requirements set by the ANSI standards committee
in SQL3. Those extensions will offer interfaces to C++ that support
complex objects.