Compiling DBD::Oracle with Borland C++ 5.5, I have a bunch of warnings:
Warning W8065 ...: Call to function 'OCI...' with no prototype in function
because oci.h includes the K&R headers:
#if defined(__STDC__) || defined(__cplusplus) #include <ociapr.h> #include <ociap.h> #else #include <ocikpr.h> #include <ocikp.h> #endif
That means, neither __STDC__ nor __cplusplus is defined. These are predefined macros:
__STDC__ = 1 Defined if you compile with the -A compiler option; otherwise, it is undefined. _cplusplus = 1 Defined if in C++ mode; otherwise, undefined.
and depend on these command-line switches:
Language compliance options:
-A ANSI -A- Borland extensions
General compiler output options:
-P The -P command-line option causes the compiler to compile all source files as C++ files, regardless of their extension. Use -P- to compile all .CPP files as C++ source files and all other files as C source files.
Now, I have the following options:
1. ignore the warnings :-(
2. suppress the warnings (-w-8065)
3. Force __STDC__=1
a) command-line switch -A:
win*.h don't compile (non-standard keywords)
b) #define __STDC__ 1:
even in this case some files don't compile
c) #define/#undef around #include oci.h:
works, but quite hackerish
4. Force C++ compile (-P):
Warnings: Style of function definition is now obsolete Errors : Error E2034 ...: Cannot convert '...' to '...' in function
If I go the C++ route, I'd need to add some casts to avoid the errors and convert K&R style functions to ANSI. Would you accept these patches? As an example, the attached patch adds the casts to dbdimp.c.
Steffen
--- dbdimp.orig Fri Aug 06 17:54:00 2004 +++ dbdimp.c Mon Sep 20 22:18:54 2004 @@ -1226,7 +1226,7 @@ phs->desc_t = OCI_HTYPE_STMT; OCIHandleAlloc_ok(imp_sth->envhp, &phs->desc_h, phs->desc_t, status); } - phs->progv = (void*)&phs->desc_h; + phs->progv = (char*)&phs->desc_h; phs->maxlen = 0; OCIBindByName_log_stat(imp_sth->stmhp, &phs->bndhp, imp_sth->errhp, (text*)phs->name, (sb4)strlen(phs->name), @@ -1274,7 +1274,7 @@ imp_sth_csr->svchp = imp_sth->svchp; /* assign statement handle from placeholder descriptor */ - imp_sth_csr->stmhp = phs->desc_h; + imp_sth_csr->stmhp = (OCIStmt*)phs->desc_h; phs->desc_h = NULL; /* tell phs that we own it now */ /* force stmt_type since OCIAttrGet(OCI_ATTR_STMT_TYPE) doesn't work! */