Board index » delphi » Why Am I getting this EOLESysError?

Why Am I getting this EOLESysError?

I'm trying to run some ADO components from a datamodule in a DLL (I'm
testing whether it is possible to do this for easy swapping in and out of
interfaces to various different but similar data sources).

One of the exported procedures of the datamodule unit and the DLL itself is

procedure CreateDM;
begin
  DM := TDM.Create(Application);
end;

which is trying to create the datamodule and store the pointer in the global
DM variable.

The problem is that I get an EOLESysError in the Create.  Specifically, the
CoCreateInstance in the CreateADOObject called to create an instance of a
TADOConnection component.  The error code is -2147221008 and the message is
CoInitialize has not been called.

Does something extra, like a manual call to CoInitialize, have to be done to
initialize the ADO components on a Datamodule in a DLL?

Thanks in advance for any help.

--
Please respond only in the newsgroup.  I will not respond
to newsgroup messages by e-mail.

 

Re:Why Am I getting this EOLESysError?


Quote
Mark Reichert <m...@messagelink.com> wrote in message

news:864lg1$g4412@bornews.borland.com...

Quote
> Does something extra, like a manual call to CoInitialize, have to be done to
> initialize the ADO components on a Datamodule in a DLL?

In this scenario it is best if CoInitialize is called from the executable
program and not from the DLL.  The easiest way to do this is to simply add
"ComObj" to the uses clause of the project or one of it's forms.

The VCL code won't automatically call CoInitialize when it is used in DLL
because it's not safe to do so in some cases.

Mark

Re:Why Am I getting this EOLESysError?


Mark Edington (Borland) <meding...@nolunchmeat.com> wrote in message
news:865ai5$gat22@bornews.borland.com...

Quote
> Mark Reichert <m...@messagelink.com> wrote in message
> news:864lg1$g4412@bornews.borland.com...

> > Does something extra, like a manual call to CoInitialize, have to be
done to
> > initialize the ADO components on a Datamodule in a DLL?

> In this scenario it is best if CoInitialize is called from the executable
> program and not from the DLL.  The easiest way to do this is to simply add
> "ComObj" to the uses clause of the project or one of it's forms.

> The VCL code won't automatically call CoInitialize when it is used in DLL
> because it's not safe to do so in some cases.

Eventually figured that out on my own.

Now I have one last problem of the program causing all sorts of page faults
on the way out after I've clicked the title bar close button.  Get an
endless series of dialogs telling me that program has terminate prematurely
due to page faults.  Have to reboot the computer.

Any ideas?  Or do you at least know in which newsgroup I should ask?
--
Please respond only in the newsgroup.  I will not respond
to newsgroup messages by e-mail.

Re:Why Am I getting this EOLESysError?


Quote
Mark Reichert <m...@messagelink.com> wrote in message

news:865bke$ghg1@bornews.borland.com...

Quote
> Any ideas?  Or do you at least know in which newsgroup I should ask?

Try making sure you explicityly close down any ADO connections you may have open
before any of the shutdown process starts.  When using DLL's sometime the order
in which things get unloaded will cause a problem.

Mark

Re:Why Am I getting this EOLESysError?


Mark Edington (Borland) <meding...@nolunchmeat.com> wrote in message
news:865hql$ghi8@bornews.borland.com...

Quote
> Mark Reichert <m...@messagelink.com> wrote in message
> news:865bke$ghg1@bornews.borland.com...

> > Any ideas?  Or do you at least know in which newsgroup I should ask?

> Try making sure you explicityly close down any ADO connections you may
have open
> before any of the shutdown process starts.  When using DLL's sometime the
order
> in which things get unloaded will cause a problem.

Well, I was closing the table and then the ADOConnection in the Form
Destroy.  I'll try moving it upstream and making sure it has actually
happened before proceeding with the shutdown.
--
Please respond only in the newsgroup.  I will not respond
to newsgroup messages by e-mail.

Other Threads