I am trying to use Blackfish SQL in Codegear C++ Builder 2007 but I am
having issues on getting the program to close down after I have connected.
I have a simple 1 form (with a button on it) application that works ok when
connecting to the application, but when I try to close it, it will not close
at all.
//---------------------------------------------------------------------------
#include <vcl.h>
#include <DBXCommon.hpp>
#pragma hdrstop
#include "Main.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
try
{
TDBXConnectionEx *connection = static_cast<TDBXConnectionEx
*>(TDBXConnectionFactory::GetConnectionFactory()->GetConnection("blackfishsqlconnection",
"", ""));
if(connection)
{
ShowMessage("Connected ok");
delete connection;
}
}
catch(Exception& ex)
{
ShowMessage("Connection failed with message " + ex.Message);
}
}
//---------------------------------------------------------------------------
I have built the application with the usual defaults, build with packages
and include the dbxcommondriver package.
When I pause the application while it is hung after the main form has
disappeared, I get the following callstack:
:771e9a94 ntdll.KiFastSystemCallRet
:771e83b4 ntdll.ZwDelayExecution + 0xc
:761e1c7a kernel32.Sleep + 0xf
:2115441e ; C:\Borland\BDS5\bin\BORLNDMM.DLL
:200180bf ; C:\Windows\system32\rtl100.bpl
:20006d25 rtl100.@System@@HandleAnyException$qqrv + 0x35
:771e9b6b ntdll.RtlRaiseStatus + 0x86
:771e99f7 ntdll.KiUserExceptionDispatcher + 0xf
:200180bf ; C:\Windows\system32\rtl100.bpl
:20006d25 rtl100.@System@@HandleAnyException$qqrv + 0x35
:771e9b6b ntdll.RtlRaiseStatus + 0x86
:771e99f7 ntdll.KiUserExceptionDispatcher + 0xf
:2000a204 rtl100.@System@UnregisterModule$qqrp17System@TLibModule + 0x20
:002C13E6 Sysinit::UninitializeModule()
:771ce1c4 ; ntdll.dll
:771ba8dd ntdll.RtlExitUserProcess + 0xe6
:771ba85f ntdll.RtlExitUserProcess + 0x68
:76203b69 kernel32.ExitProcess + 0x15
:32887640 ; C:\Windows\system32\CC3280MT.DLL
:328848e9 CC3280MT.__wexecvpe + 0x85
:32884904 CC3280MT._exit + 0x10
:32887918 ; C:\Windows\system32\CC3280MT.DLL
So there seems to be an exception when in System::UnregisterModule() that is
causing the issue.
Does anybody have a simple application that uses BlackfishSQL in C++ Builder
(all examples are in Delphi, and the Delphi equivalent of this program
closes properly) without using the design time components, or have any clues
on what else I should include to get this to work?
Thanks
Steve