Board index » delphi » HELP !!! Access Violation in DLL that accesses database

HELP !!! Access Violation in DLL that accesses database

Anyone,

I've  written a DLL that contains a Wizard that is to be used from my app.
My App is calling a function in the DLL with AppHandle and DBHandle as
parameters. The Wizard contains a dialog that has it's own Database
component. I set Database1.Handle := dbHandle ( the parameter ) the usual
way. Everything seems to be OK until the DLL unloads, then I get a Access
violation....
But if I comment out the assignment Database1.Handle := dbHandle -- no
access violation!

Any clues would be greatly appreciated!

thanks
Harald

 

Re:HELP !!! Access Violation in DLL that accesses database


Harald,

Try setting Database1.Handle := 0; before the DLL exits.

Glenn.

Quote
Harald C. Hops? wrote:
> Anyone,

> I've  written a DLL that contains a Wizard that is to be used from my app.
> My App is calling a function in the DLL with AppHandle and DBHandle as
> parameters. The Wizard contains a dialog that has it's own Database
> component. I set Database1.Handle := dbHandle ( the parameter ) the usual
> way. Everything seems to be OK until the DLL unloads, then I get a Access
> violation....
> But if I comment out the assignment Database1.Handle := dbHandle -- no
> access violation!

> Any clues would be greatly appreciated!

> thanks
> Harald

Re:HELP !!! Access Violation in DLL that accesses database


Glenn,
I've tried this with no result in this particular DLL. I've done it in other
DLL's with great success.....
The  only difference is that the database component ( and tables ) are
located in a internal DLL Dialog.
The FormDestroy handler is like this;
--
procedure TdlgOppgiRabKode.FormDestroy(Sender: TObject);
begin
     Database1.Handle := hDBIDb(0);
end;
--
Harald

Quote
>Harald,
>Try setting Database1.Handle := 0; before the DLL exits.
>Glenn.
Harald C. Hops? wrote:
> Anyone,

> I've  written a DLL that contains a Wizard that is to be used from my app.
> My App is calling a function in the DLL with AppHandle and DBHandle as
> parameters. The Wizard contains a dialog that has it's own Database
> component. I set Database1.Handle := dbHandle ( the parameter ) the usual
> way. Everything seems to be OK until the DLL unloads, then I get a Access
> violation....
> But if I comment out the assignment Database1.Handle := dbHandle -- no
> access violation!

> Any clues would be greatly appreciated!

> thanks
> Harald

Re:HELP !!! Access Violation in DLL that accesses database


Anyone,
Problem solved....
Remeber use ShareMEM in DLL and APP, and set Database1.Handle :=  nil;

harald

Harald C. Hops? skrev i meldingen <6f5e0t$c2...@forums.borland.com>...
|Glenn,
|I've tried this with no result in this particular DLL. I've done it in
other
|DLL's with great success.....
|The  only difference is that the database component ( and tables ) are
|located in a internal DLL Dialog.
|The FormDestroy handler is like this;
|--
|procedure TdlgOppgiRabKode.FormDestroy(Sender: TObject);
|begin
|     Database1.Handle := hDBIDb(0);
|end;
|--
|Harald
|
|>Harald,
|>Try setting Database1.Handle := 0; before the DLL exits.
|>Glenn.
|

Quote
|Harald C. Hops? wrote:

|> Anyone,
|>
|> I've  written a DLL that contains a Wizard that is to be used from my
app.
|> My App is calling a function in the DLL with AppHandle and DBHandle as
|> parameters. The Wizard contains a dialog that has it's own Database
|> component. I set Database1.Handle := dbHandle ( the parameter ) the usual
|> way. Everything seems to be OK until the DLL unloads, then I get a Access
|> violation....
|> But if I comment out the assignment Database1.Handle := dbHandle -- no
|> access violation!
|>
|> Any clues would be greatly appreciated!
|>
|> thanks
|> Harald
|
|
|

Other Threads