Delphi fastMM doesn't work with operator "IS"

Posted by Joc02 on Stack Overflow See other posts from Stack Overflow or by Joc02
Published on 2014-06-10T15:22:08Z Indexed on 2014/06/10 15:24 UTC
Read the original article Hit count: 237

Filed under:
|
|

I work on Delphi project who interac with many other small libraries. I use FastMM4 and I would like work with complex classes passed on dll parameter.

So for exemple I send my form to my dll. Into the dll I test the type of parameter with the operator "IS".

But into the Dll the operator "IS" return always "false"

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.

And the call

procedure TffsIsOperator.Button2Click(Sender: TObject);
var
 MaDLL : THandle;
 Proc  : procedure (l : TForm);
begin
   try
      MaDLL := LoadLibrary(PChar('Dll.dll'));
      @Proc := GetProcAddress(MaDLL, 'Complex');
      Proc(self);
   finally
      FreeLibrary(MaDLL);
   end;
end;

© Stack Overflow or respective owner

Related posts about delphi

Related posts about dll