저는 많은 다른 작은 라이브러리들과 상호 작용하는 Delphi 프로젝트를 작업합니다. FastMM4를 사용하며 dll 매개 변수에 전달 된 복잡한 클래스로 작업하고 싶습니다.is 연산자가 다른 모듈의 인스턴스를 전달할 때 예상 한 값을 반환하지 않는 이유는 무엇입니까?
예를 들어 내 양식을 내 dll로 보냅니다. dll에 연산자 "IS"를 사용하여 매개 변수 유형을 테스트합니다.
그러나 DLL을 운영자에
가Exemple
library Dll;
uses
FastMM4,
System.SysUtils,
System.Classes,
Vcl.Dialogs,
Vcl.Forms;
{$R *.res}
procedure Complex(L : TObject);stdcall;
begin
if L is TForm then
showmessage('Ok')
else
showmessage('Pas ok') ;
if L is TCustomFrame then
showmessage('Ok')
else
showmessage('Pas ok')
end;
exports
Complex;
begin
end.
그리고 첫째
procedure TffsIsOperator.Button2Click(Sender: TObject);
var
MaDLL : THandle;
Proc : procedure (l : TObject);
begin
try
MaDLL := LoadLibrary(PChar('Dll.dll'));
@Proc := GetProcAddress(MaDLL, 'Complex');
Proc(self);
finally
FreeLibrary(MaDLL);
end;
end;
호출 규칙에주의하십시오. 귀하의 선언이 서로 일치하지 않습니다. –
물론이 예제에서는 코드를 줄이기 위해 마지막으로 변경합니다. 죄송합니다. "Proc : procedure (l : TObject) – Joc02