unit dll_dmunit;
interface
uses
System.SysUtils, System.Classes, Data.DB, Datasnap.DBClient, Vcl.Dialogs,Vcl.DBGrids;
type
TStudentModule = class(TDataModule)
StudentSet: TClientDataSet;
StudentSource: TDataSource;
StudentSetNAME: TStringField;
StudentSetID: TIntegerField;
StudentSetAGE: TIntegerField;
StudentSetSLNo: TAutoIncField;
dlgOpen: TOpenDialog;
dlgSave: TSaveDialog;
private
{ Private declarations }
public
end;
procedure loadfile;stdcall;
procedure set_file(name_of_file:string);stdcall;
var
StudentModule: TStudentModule;
filename:string;
implementation
procedure set_file(name_of_file: string);stdcall;
begin
filename:=name_of_file;
end;
procedure loadfile;stdcall;
begin
StudentModule.StudentSet.LoadFromFile(filename);
end;
end.
This is the unit that I have included in the DLL and I have exported the function loadfile in export clause. When I use this function in a program I get an error read of address violation. I need to perform operation on TClientDataSet like load and save in a Dll and later use those in the programs. First I am calling the set_file method to initialise the filename Please help me regarding this. Thanking you in anticipation.