In Delphi 2009 I'm finding that any time I do perform both a connection to Oracle (via OCI.dll) and a call to a web service method I get an exception in ntdll.dll when closing my application in the IDE.

For the connection to Oracle I tried using both DOA (Direct Oracle Access) 4.1.1.0 and ODAC components (latest trial version);

For the web service method call (just a simple "function HelloWorld: string") I am using Delphi stock capabilities, after importing the WSDL from the web service.

If I use ODAC components in "direct" mode, that is not using OCI.dll, no exception occurs on closing.

If I call a web service method only (without connecting to Oracle), no exception occurs on closing (even if I use either DOA or ODAC components).

If I connect to Oracle (via OCI.dll) only (without calling a web service method), everything goes fine too (no matter if I use either DOA or ODAC components).

The very same code runs perfect when executed both in Delphi 7 and Delphi XE2: no exception occurs on application closing.

Some information: Delphi 2009 (stock and Update 3 version) OS: Windows 7 32 bit Oracle Instant Client 10.2.0.4 and Oracle Instant Client 10.2.0.5

I start suspecting that it might be an issue related to heap corruption in Delphi 2009 on application closing...

Any help please?

Steps to reproduce (from the comment):

  1. Create a new VCL Forms Application
  2. Place a TOracleSession DOA component (named OracleSession1) on the Form
  3. Place a TButton on the Form (named Button1)
  4. Place this event handler for the button click event:

Here is the code:

procedure TForm1.Button1Click(Sender: TObject);
var
   MyWebService3Soap: WebService3Soap;
   s: string;
begin
   OracleSession1.LogonDatabase := 'SomeLogonDB';
   OracleSession1.LogonUsername := 'SomeUsername';
   OracleSession1.LogonPassword := 'SomePassword';
   OracleSession1.Connected := True;
   ShowMessage('Connected');

   MyWebService3Soap := GetWebService3Soap();
   s := MyWebService3Soap.HelloWorld(); // Just returns a string such as "Hello World"
   ShowMessage(s);
 end;

The "WebService3Soap" interface is the one automatically generated by Delphi 2009 WSDL Importer. Here is the meaningful part:

WebService3Soap = interface(IInvokable)
  ['{F6F12FA6-3881-8BB5-AD71-2408B47692CD}']
    function  HelloWorld: string; stdcall;
  end;

function GetWebService3Soap(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): WebService3Soap;

initialization
  InvRegistry.RegisterInterface(TypeInfo(WebService3Soap), 'http://mytest.it/Test3', 'utf-8');
  InvRegistry.RegisterDefaultSOAPAction(TypeInfo(WebService3Soap), 'http://mytest.it/Test3/HelloWorld');
  InvRegistry.RegisterInvokeOptions(TypeInfo(WebService3Soap), ioDocument);
end.

Run the application inside the IDE, press the button (close the 2 following ShowMessages) and then close the form.

有帮助吗?

解决方案

Given the hint that it might be a "DLL hell" issue, I was able to run a test both on Windows XP and on Vista: everything went fine. So I started thinking that this issue had somehow to be related to Delphi 2009 on Windows 7.

I was right and I found that there is an issue In Delphi 2009 with debugging on Windows 7.

Fortunately a patch is available:

ID: 27476, Hotfix 2 for Delphi 2009 and C++Builder 2009

Applying the patch solved!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top