Thanks Max, I guess I'll stick with what I have.... Cheers, Phil. ----- Original Message ----- From: "Max Nilson" <[EMAIL PROTECTED]> To: "'NZ Borland Developers Group - Delphi List'" <[EMAIL PROTECTED]> Sent: Thursday, September 09, 2004 10:02 AM Subject: RE: [DUG] Passing Objects to a DLL
> Phil Middlemiss asked: > > > Thanks Max, I thought it was something like that, but didn't > > know the specifics. BPL's are out of the question for us... > > we looked at that and ruled it out earlier since the > > versioning nightmare is even worse than with DLL's. Is the > > BPL the only way around it? > > I've looked at the code concerned, _IsClass and _AsClass in System.pas that > implement 'is' and 'as' to support the compiler, and the only fix I can > think of is exactly equivalent to the solution you already have. > > Anyway what you could do is runtime patch the _IsClass and _AsClass (plus > optionally TObject.InheritsFrom) routines to perform a jump into alternative > code that does the same walk up the VMT parent poiner list, but compares by > name rather than VMT pointer. > > But apart from that the entire Delphi object supprt code is based on the > concept of an object being a a point to a block of memory, the first 4 bytes > of which are the pointer to the objects VMT. The only possible way to > intercept this behaviour would be to hack TObject.InitInstance to create > objects instances with the VMT pointer set to the EXE's VMT rather than the > DLL's VMT. To do this you would need to export some sort of help function > from the EXE that could return the VMT pointer for a named class and use > this in the DLL's. > > Cheers, Max. > > > > > _______________________________________________ > Delphi mailing list > [EMAIL PROTECTED] > http://ns3.123.co.nz/mailman/listinfo/delphi _______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi
