1

I created a database program which has a problem. I used Borland Delphi 7.x

My Question is

"How to create a data module in Dll (Dynamic Link Library) With Delphi?

A J Qarshi
  • 2,772
  • 6
  • 37
  • 53
Tobassum Munir
  • 373
  • 1
  • 7
  • 14
  • 1
    A description of the observed behavior might help generate more answers. The question as stated is too vague. – skamradt Jul 16 '09 at 17:55
  • Hi Tobassum, can you clarify? 1) is it to create a tdatamodule instantiate it, and reference it with procedures exposed to the dll consumer? 2) is it that you want to dynamically create a tdatamodule and return it's handle to the consumer of a function of the dll? 3) Or are you just wondering how to add a data module to your dll project? – Jason T Jul 16 '09 at 17:56

2 Answers2

2

You can create the code from the data module, just like you would in a normal application. File|New|Data Module

But I am guessing that you want to create an instance of a data module in a DLL.

DataModules are no different other classes and components, and can be created in code.

var
  DM : TMyDataModule;
begin
  DM := TMyDataModule.Create(nil); 
  try
 // Then...   DM.MyDataSet.First; etc...
  finally
    DM.Free; 
  end;
end;
Bruce McGee
  • 15,076
  • 6
  • 55
  • 70
Robert Love
  • 12,447
  • 2
  • 48
  • 80
1

Open your DLL project in the IDE. Under the File|New menu, do you see an option for Data Module?

Bruce McGee
  • 15,076
  • 6
  • 55
  • 70