Phil Middlemiss replied:

> Indeed. Good comments. Infact, after thinking about it a bit 
> more I suspect we are going to have to redesign parts of the 
> plugin mechanism. As you hint at, we are defeating our own 
> reason for not using BPLs by relying on class comparisons 
> anyway (to then access class properties). We won't switch to 
> BPLs but will have to redesign what we are doing so that 
> class comparison (followed by accessing properties) is not necessary.

If all you are doing is accessing class properties then the one solution is
come to mind immediately. It goes along these lines:

Firsty treat all object passed to the plugin as an opaque 'handle'. This is
the standard sort of technique used by software that must pass objects to
other code that doesn't understand them (eg C++ to C).

Then export some methods from your application that the DLL's can bind to
that take a handle and a property refernece of some kind, and that returns
the value of that property. Depending on need you can make these as funky as
needed rembering that you need to be very careful passing back strings and
any other object that is manged by the application memory manager.

Something like:

  function GetObjectInteger(Handle: Pointer;
    PropertyName: PChar): Integer; stdcall;
  function GetObjectDouble(Handle: Pointer;
    PropertyName: PChar): Double; stdcall;
  function GetObjectString(Handle: Pointer;
    PropertyName: Pchar; Buffer: PChar;
    BufferSize: DWORD): Integer; stdcall;

This keeps all the object access code inside your application and provides a
nicely delimited interface that any other language can use (as long as you
are very careful about the types used).

Of course you could also pass the objects as IUnknown interfaces, and
publish an interface like:

  IPropertyAccess = interface
    [GUID goes here]
    function GetObjectInteger(PropertyName: PChar): Integer; stdcall;
    function GetObjectDouble(PropertyName: PChar): Double; stdcall;
    function GetObjectString(PropertyName: Pchar; Buffer: PChar;
      BufferSize: DWORD): Integer; stdcall;
  end;

That the DLL's can QueryInterface for, which gies you the same sort of thing
with having to export stuff from your application and with the possibility
of cleaner improvements in the future.

Cheers, Max.




_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to