That is why use BPL's instead. With a DLL you have your own copy of System and hence TObject and then get the case that TObject is <> to TObject as there is now two copies TObject VMT's etc.
I seem to remember there are other issues with DLL's vs BPLs too. Myles. -----Original Message----- From: Phil Middlemiss [mailto:[EMAIL PROTECTED] Sent: Monday, 17 March 2003 8:17 a.m. To: Multiple recipients of list delphi Subject: [DUG]: Passing Objects from DLLs Hi all, we are building a plugin architecture and have a few questions about passing objects from a DLL into the main app. For example, we want a dll to be able to pass an instance of a TPanel that is then embedded into a TNotebook on a form in the main application. We pass this panel, as a pointer, as part of a variant open array parameter (array of const). So the DLL would call something like: MyNewPanel := TPanel.Create(nil); // we will free it our selves later MyNewPanel.Parent := nil; // the main app will assign the parent PluginManager.ProcessCommand("AddPanel", [EMAIL PROTECTED]); This is effectively received in the main app as: TMainApp.ProcessCommand(CommandName : WideString; Parameters : Array of Const); var ANewPanel : TPanel; begin ... ANewPanel := TPanel(Parameters[0].vPointer^); ... end; The panel seems to be received correctly - sort of. The Evaluate/Modify window evaluates ANewPanel.Classtype as TClass($12345) except with the actual address. If we now try and assign a font to the panel we get an error "Can't assign a TFont to a TFont". It seems that the RTTI is not correctly being passed from the DLL to the main app. Is this a side effect of passing objects from a DLL, or is this a side effect of passing it in a variant open array? How do we get around this? Phil. --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
