-3
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.
이것은 DLL에 포함 된 단위이며 export 절에 loadfile 함수를 내 보냈습니다. 프로그램에서이 기능을 사용할 때 주소 읽기 오류가 발생합니다. 로드와 같은 TClientDataSet에서 작업을 수행하고 Dll에 저장하고 나중에 프로그램에서 사용해야합니다. 먼저 set_file 메서드를 호출하여 파일 이름을 초기화합니다. 이 문제에 관해 도움을주십시오. 감사합니다.DLL에서 TClientDataSet에 액세스
내 응용 프로그램에서이 loadfile 메서드를 호출하고 DLL 끝에서 TclientDataSet을로드 할 수 있습니다. 이제 DLL에서 TClientDataSet의 내용을 응용 프로그램 끝에서 볼 수있게하려고합니다. 도와주세요. –
@ user3615007 당신은 새로운 질문에 그 요청을 넣어야합니다. DLL과 Delphi 응용 프로그램간에 TClientDataSet을 공유하려고 할 때 약간의 배경 지식을 제공하는 것이 도움이됩니다. 나는 그 일을하는 가장 좋은 방법이라고 확신하지 못합니다. 일부 배경은 사람들이 왜 그 이유를 이해하고 더 나은 해결책을 찾을 수 있도록 도와줍니다. – Graymatter
감사합니다. Graymatter 저는 다른 사람들이 저를 쉽게 도울 수 있도록 내 문제를 더 잘 이해할 수 있도록 새로운 질문에 확실히 요청할 것입니다. –