Jump to content

David Hoyle

Members
  • Content Count

    184
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by David Hoyle


  1. I can't find a way of saving or pinning threads like this so have replied instead as this is a goldmine of information.

    I'm half way through my 3 years on the old way of doing things and that was a nightmare to get the right files in the first place and setup so I was not looking forward to having to change to a token.

    I think this thread and @Vincent Parrett's blog post could well help everyone.

    regards

    Dave.


  2. I can confirm that class variables and properties are not accessible in RS 11.2...

    Program ClassProppertyRTTI;
    
    {$APPTYPE CONSOLE}
    
    {$R *.res}
    
    
    Uses
      System.SysUtils,
      System.Rtti;
    
    Type
      TMyClass = Class
      Strict Private
        FGoodbye: Integer;
      Strict Private
        Class Var FHello: String;
      Strict Protected
      Public
        Class Property Hello: String Read FHello;
        Property Goodbye : Integer Read FGoodbye;
      End;
    
    Var
      C: TMyClass;
      Ctx: TRTTIContext;
      F : TRTTIField;
      T: TRttiType;
      P: TRttiProperty;
    
    Begin
      Try
        C := TMyClass.Create;
        Try
          Ctx := TRTTIContext.Create();
          T := Ctx.GetType(C.ClassInfo);
          For F IN T.GetFields Do
            WriteLn('Field: ', F.Name);
          For P In T.GetProperties Do
            WriteLn('Property: ', P.Name);
        Finally
          C.Free;
        End;
        ReadLn;
      Except
        On E: Exception Do
          WriteLn(E.ClassName, ': ', E.Message);
      End;
    
    End.

    It only outputs FGoodbye and Goodbye.

    I didn't actually know this restriction in the RTTI.

    • Thanks 1

  3. Have you tried debugging the component package using a second IDE to see where the AV is being raised - hopefully it will show you a call stack that might help you isolate the issue.

    Does an empty package with no component registration cause an AV?

    In your component code, do you utilise any INITAILIZATION/FINALIZATION sections in your units to create or destroy objects?


  4. Loading order of DLL and thus initialization order... Yes I have experimented as I use the "feature" to order my experts as sometimes they don't play well together. Changing their order can help.

    I do not understand what you mean by "execution order"?

     

×