Главная страница | назад





Article #18804: Access Violation when opening BDE Object in DataModule of DLL

 Question and Answer Database

FAQ3804B.txt   Access Violation when opening BDE Object in DataModule of DLL
Category   :Database/VCL
Platform    :All Windows
Product    :   C++Builder1.0   C++Builder3.x   Delphi2.x   Delphi3.x   Delphi4.x

Question:
Why do I receive an Access Violation when I open any BDE object 
(Session, Database, Stored Procedure, Table) contained in
a Data Module in my DLL?

Answer:
Forms and Data Modules in DataModules in DLLs are not 
autocreated. You instantiate them yourself. The most
likely place to do this is in DLL entry point. 
Where DMod is the name of your Data Module, in C++
Builder the code would look as follows:

if reason = DLL_PROCESS_ATTACH
      DMod = new TDMod(NULL);

in Delphi it looks like:

if reason = DLL_PROCESS_ATTACH
      DMod := TDMod.Create(Nil);

3/26/99
 

Last Modified: 01-SEP-99