Article View: borland.public.cppbuilder.database.ado
Article #5543Re: ADO in DLL?
From: Alan Lichtenstein
Date: Mon, 09 Apr 2001 16:04
Date: Mon, 09 Apr 2001 16:04
36 lines
1988 bytes
1988 bytes
I like to force the calling of CoInitialize & CoUninitialize by calling them
in the constructor & destructor methods respectively of a global variable...
Declare this variable when you first start the app.... The constructor is
called automatically when the app starts & the destructor is called when the
app goes out of scope or ends.....
For instance I borrowed this from a VC++ sample provided by Microsoft....
struct InitOle {
InitOle() { ::CoInitialize(NULL); }
~InitOle() { ::CoUninitialize(); }
} _init_InitOle_;
Lance Zhang wrote in message <3aca95fa_2@dnews>...
>Hi! All,
>
>
>Context:
>I build a sample DLL following a article named "Using A Data Module In A
>DLL" By Mr. Mark CashMan published on http://www.temporaldoorway.com about
>how to put a datamodule in a dll--specifically the way to initialize a
>datamodule in a DLL.
>
>When I use a combination of TDatabase and TQuery it works just fine.
>But when I substitute them with TADOConnection and TADOQuery, an
>EOleSysError stating "CoInitiliaze not yet called" is raised upon the
>constructor of TDataModule1.
>
>Is it a ADO bug or just I neglect some steps?
>
>Pleas help!
>
>Lance Zhang
>
>
Technical Details
Message-ID:
<3ad1dd9c$1_1@dnews>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!hammer.uoregon.edu!feed.textport.net!news.bnb-lp.com!dnewsReferences:
<3aca95fa_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,5201656cf3859ded X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2001-04-09 09:12:04 PST From: "Alan Lichtenstein" <alanl@sss.sungard.com> Newsgroups: borland.public.cppbuilder.database.ado References: <3aca95fa_2@dnews> Subject: Re: ADO in DLL? Date: Mon, 9 Apr 2001 12:04:40 -0400 Lines: 38 Organization: SunGard X-Newsreader: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 NNTP-Posting-Host: 198.62.209.10 Message-ID: <3ad1dd9c$1_1@dnews> X-Trace: dnews 986832284 198.62.209.10 (9 Apr 2001 09:04:44 -0700) Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!hammer.uoregon.edu!feed.textport.net!news.bnb-lp.com!dnews