home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.pascal.borland      Borland Pascal was actually pretty neat      2,978 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 2,635 of 2,978   
   Bitty to All   
   Classes and objects in Shared Libaries o   
   24 Mar 08 10:49:42   
   
   From: bitty@nospam.chello.nl   
      
   Hello,   
      
   I'm a newbee here, but not new on the programming edge with Pascal.   
   I'm writing a library to manage a personal office product for both Win32   
   and Linux with FreePascal. Therefore, I have to write many objects wich   
   I will bind in separated libraries.   
   To reduce the code and data overhead, I would like to include each code   
   block only once in the complete library. That means that the total   
   amount of code can be reduced to the smallest possible size.   
   The problem which raises now, is that I cannot export constructors,   
   destructors, or functions from within objects or classes to a library   
   file. Does anyone here have a solution to fix this problem?   
      
   To show the problem I have included some example coding at the end of   
   this message.   
      
   Thanks in Advance!   
      
   Bitty.   
      
   [--- example code ---]   
      
   LIBRARY testobj;   
      
   TYPE  TColorType = OBJECT   
            Red      : BYTE;   
            Green    : BYTE;   
            Blue     : BYTE;   
      
            CONSTRUCTOR Init(R,G,B:BYTE); EXPORT;   
            BEGIN   
              IF ((R <> 0) OR (G <> 0) OR (B <> 0)) THEN SetColor(R,G,B);   
              ELSE BEGIN   
                Red   := 0;   
                Green := 0;   
                Blue  := 0;   
              END;   
            END; { TColorType.Init }   
      
            DESTRUCTOR Done; VIRTUAL; EXPORT;   
            BEGIN   
            END; { TColorType.Done }   
      
            PROCEDURE SetColor(R,G,B: BYTE); EXPORT;   
            BEGIN   
              IF (R <> 0) THEN Red   := R ELSE Red   := 0;   
              IF (G <> 0) THEN Green := G ELSE Green := 0;   
              IF (B <> 0) THEN Blue  := B ELSE Blue  := 0;   
            END; { TColorType.SetColor }   
      
            PROCEDURE SetRed(R:BYTE); EXPORT;   
            BEGIN   
              Red := R;   
            END; { TColorType.SetRed }   
      
            PROCEDURE SetGreen(G:BYTE); EXPORT;   
            BEGIN   
              Green := G;   
            END; { TColorType.SetGreen }   
      
            PROCEDURE SetBlue(B:BYTE); EXPORT;   
            BEGIN   
              Blue := B;   
            END; { TColorType.SetBlue }   
      
            FUNCTION  GetRed:BYTE; EXPORT;   
            BEGIN   
              GetRed := Red;   
            END; { TColorType.GetRed }   
      
            FUNCTION  GetGreen:BYTE; EXPORT;   
            BEGIN   
              GetGreen := Green;   
            END; { TColorType.GetGreen }   
      
            FUNCTION  GetBlue:BYTE; EXPORT;   
            BEGIN   
              GetBlue := Blue;   
            END; { TColorType.GetBlue }   
      
            PROCEDURE Output; EXPORT;   
            BEGIN   
              WriteLn('R:',Red,' G:',Green, ' B:',Blue);   
            END; { TColorType.Output }   
      
          END; { OBJECT: TColorType }   
      
   EXPORTS   
      TColorType.GetBlue, TColorType.Done, TColorType.GetGreen,   
   TColorType.GetRed,   
      TColorType.Init, TColorType.Output, TColorType.SetColor,   
   TColorType.SetBlue,   
      TColorType.SetGreen, TColorType.SetRed;   
      
   END.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca