Re: Viusal Studio.NET & OCCI
Date: Fri, 10 Jan 2003 04:02:51 +0000 (UTC)
Message-ID: <avlglb$1d6$1_at_reader1.panix.com>
In <YIqT9.9896$Yo4.464867_at_news1.calgary.shaw.ca> luke <anduguid_at_shaw.ca> writes:
>i know its been discussed before, but the problem of try to build OCCI
>applications with Visual Studio.NET leading to a successful compile &
>link but the application generating 'illegal memory address' errors when
>executed... has it been solved or a workaround perhaps?
[Quoted] I have filed a Metalink TAR on this very issue. Oracle's response was that the use of Visual Studio.NET (aka VC++ version 7.00) is unsupported in all versions of Oracle, including 9iR2 client/programmer.
However, I have had excellent success and progress integrating Pro*C in C++ mode with VS.NET. And the lessons learned there may help elsewhere.
In your DatabaseInterface project, add an additional library directory of 'C:\oracle\ora92\precomp\lib\msvc' (suitably adjusted for your $ORACLE_HOME value), and add an additional dependency of 'orasql9.lib'.
<Tool Name="VCLibrarianTool" AdditionalDependencies="orasql9.lib" OutputFile="$(OutDir)/DatabaseInterface.lib" AdditionalLibraryDirectories="C:\oracle\ora92\precomp\lib\msvc"/>
Next, in your .PCC file (my name for Pro*C C++ files), set up a custom build-step:
<File
RelativePath="OraRepositoryDatabase.pcc"> <FileConfiguration Name="Debug|Win32"> <Tool Name="VCCustomBuildTool" CommandLine="C:\oracle\ora92\bin\proc parse=partial code=cpp include="$(VCInstallDir)/include" cpp_suffix=cpp oname="$(InputDir)/_$(InputName).cpp"" Outputs="$(InputDir)/_$(InputName).cpp"/> </FileConfiguration>
</File>
Key components of that CommandLine are:
path to PROC text mode compiler,
'parse=partial code=cpp', required for C++ code
'include="$(VCInstallDir)/include"', to let Pro*C know where your system
include files are located (double-quotes are in case your Install
directory contains spaces, like "Program Files"
'cpp_suffic=cpp' optional, but feels good
'oname="$(InputDir)/_$(InputName).cpp"', to create the output file anme
with a leading Underscore
Why the leading underscore? Well, because if you use Visual Source Safe, and don't remember to checkout (mark as read-write) the destination file, Pro*C errors out with an internal assert, related to the fact that it couldn't write to the output file.
Then, add a new file named "Blah.cpp", which consists of the 1 line: #include "_Blah.cpp"
where "Blah" is the name of your .PCC pro*c precompiled file.
Link. Debug. Repeat.
>all previous posts on the subject describe the problem but none describe
>a solution.
[Quoted] That was my experience as well.
OCCI is a special case: It can ONLY be bound with the MSVCRT libraries, which precludes the use of the debug or other libraries in LIBC*, including the MT (multi-thread) or single-threaded runtimes. I suppose it might be possible to make VC.NET work with MSVCRT, but:
Alas, my application requires being able to DEBUG, so I gave up on OCCI. I attempted to use third party libraries like OCI Wrap, in order to gain access to the LOB (BLOB, CLOB, and NCLOB) support, but this did not work as well as I had wished. :( And required me to know more about their object design than I was willing to spend time learning.
>thanks in advance,
>luke
[Quoted] You're welcome. I hope this helps. Email questions welcomed, to my work address, andy at play dot net.
Andy
-- Andrew Finkenstadt (http://www.finkenstadt.com/andy/)Received on Fri Jan 10 2003 - 05:02:51 CET