<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi Matt, casting doesn't actually work when you are 
trying to compare class types since you don't know what class you have anyway. 
The tag idea may as well just be the the classname which is what we use as a 
workaround anyway. If an object is passed into a dll it's fine since it shares 
the same application space, but I think the issue is with the run time type 
information that Delphi uses. For example if I use the debugger to have a look 
at&nbsp;a class variable passed into a dll, it doesn't give the classname, it 
give something like TClass($4F801) (except a real memory address).</FONT></DIV>
<DIV><FONT face=Arial size=2>Thanks anyway.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Cheers,</FONT></DIV>
<DIV><FONT face=Arial size=2>Phil.</FONT></DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=matt@ferndigital.com href="mailto:matt@ferndigital.com">Matt Comb</A> 
  </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=delphi@ns3.123.co.nz 
  href="mailto:delphi@ns3.123.co.nz">NZ Borland Developers Group - Delphi 
  List</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, September 08, 2004 4:54 
  PM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [DUG] Passing Objects to a 
  DLL</DIV>
  <DIV><BR></DIV>
  <DIV><FONT face=Arial size=2>Hey Phil, as you know doubt know, passing any 
  type of memory around that is dynamic (e.g. string) as apposed to static (e.g. 
  integer) is not a good idea. I haven't looked but maybe this class information 
  uses strings to store different things, and therefore is 
  unreliable.</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>How many different types of object are you 
  passing through? could you perhaps set the object tag value (e.g. tag=1 = 
  twhatever tag=2 = twhatever2&nbsp;and then cast type within the dll? ) This 
  would mean though that you would have to upgrade your dll if you want to 
  support any additional type of objects.</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>By the way, I would recommend you not doing this 
  at all. I would pass what information you need from the object through in a 
  static object type, create an object of the type required within the dll and 
  do what you have to do, but of course that would completely depend on the type 
  of object you are throwing around.</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>Matt.</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <BLOCKQUOTE 
  style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
    <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
    <DIV 
    style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
    <A title=phil@tumonz.co.nz href="mailto:phil@tumonz.co.nz">Phil 
    Middlemiss</A> </DIV>
    <DIV style="FONT: 10pt arial"><B>To:</B> <A title=delphi@ns3.123.co.nz 
    href="mailto:delphi@ns3.123.co.nz">NZ Borland Developers Group - Delphi 
    List</A> </DIV>
    <DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, September 08, 2004 
    4:47 PM</DIV>
    <DIV style="FONT: 10pt arial"><B>Subject:</B> [DUG] Passing Objects to a 
    DLL</DIV>
    <DIV><BR></DIV>
    <DIV><FONT face=Arial size=2>When an object is passed to a DLL it comes 
    across fine and all properties and methods can be accessed, but somehow the 
    class information gets handled differently. Using&nbsp;the 
    "is"&nbsp;comparison fails when it should work - even InheritsFrom doesn't 
    work. We've got around this in the past by using a recursive routine to 
    compare class/ancestor names but I'm beginning to wonder if there is a trick 
    that I have missed somewhere.</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>Can anyone shed any light on this?</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>Cheers,</FONT></DIV>
    <DIV><FONT face=Arial size=2>Phil.</FONT></DIV>
    <P>
    <HR>

    <P></P>_______________________________________________<BR>Delphi mailing 
    list<BR>Delphi@ns3.123.co.nz<BR>http://ns3.123.co.nz/mailman/listinfo/delphi<BR></BLOCKQUOTE>
  <P>
  <HR>

  <P></P>_______________________________________________<BR>Delphi mailing 
  list<BR>Delphi@ns3.123.co.nz<BR>http://ns3.123.co.nz/mailman/listinfo/delphi<BR></BLOCKQUOTE></BODY></HTML>