home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / threads.zip / asyncnot.HPP < prev    next >
C/C++ Source or Header  |  1995-09-13  |  3KB  |  96 lines

  1.  
  2.  
  3. /* 
  4.  * This file was created for George DeCandio 
  5.  * by Project Smarts on 13 Sep 1995. 
  6.  */
  7.  
  8. //-------------------------------------------
  9. // asyncnot.h - Header file for a C++ DLL
  10. //-------------------------------------------
  11.  
  12.  
  13. /*-----------------------------------------------------------------*/
  14. /* This file defines 3 classes, area, rectangle, and triangle      */
  15. /* whose members are explicitly exported using the #pragma export  */
  16. /* directive.  With #pragma export you can assign ordinals to the  */
  17. /* symbols so that they are maintained when you update the DLL.    */
  18. /* #pragma export also lets you specify the external name of the   */
  19. /* symbol.  To export your classes in this manner, you must add a  */
  20. /* #pragma export directive for each member data, function,        */
  21. /* constructor and destructor you want to export.  You must always */
  22. /* export constructors and destructors.  See the end of this file  */
  23. /* to see how it is done.                                          */
  24. /*-----------------------------------------------------------------*/
  25.  
  26.  
  27. /*--------------------------*/
  28. /* Define a base class      */
  29. /*--------------------------*/
  30. class area
  31.    {
  32.    private:
  33.       double dim1, dim2;
  34.    public:
  35.       static int   objectCount;
  36.       void setarea(double d1 , double d2);
  37.       void getDim(double &d1, double &d2);
  38.       virtual double getArea();
  39.       area::area(void);
  40.    };
  41.  
  42.  
  43. /*-----------------------------*/
  44. /* Define a derived class      */
  45. /*-----------------------------*/
  46. class rectangle : public area
  47.    {
  48.    public:
  49.       static int objectCount ;
  50.       double getArea();
  51.       rectangle::rectangle(void);
  52.    };
  53.  
  54.  
  55. /*------------------------------*/
  56. /* Define another derived class */
  57. /*------------------------------*/
  58. class triangle : public area
  59.    {
  60.    public:
  61.       static int objectCount;
  62.       double getArea();
  63.       triangle::triangle(void);
  64.    };
  65.  
  66.  
  67. /*--------------------------------------------------------*/
  68. /* Export symbols from the declared classes               */
  69. /*--------------------------------------------------------*/
  70. #pragma export(area::objectCount, "countArea", 1)
  71. #pragma export(area::getDim, "getAreaDimensions", 2)
  72. #pragma export(area::getArea, "getAreaArea", 3)
  73. #pragma export(area::area(), "createArea", 4)
  74. // Note:  area::setarea() is not exported because it is not required
  75.  
  76. #pragma export(triangle::objectCount, "countTriangle", 5)
  77. #pragma export(triangle::getArea, "getTriangleArea", 6)
  78. #pragma export(triangle::triangle(void), "createTriangle", 7)
  79.  
  80. #pragma export(rectangle::objectCount, "countRectangle", 8)
  81. #pragma export(rectangle::getArea, "getRectangleArea", 9)
  82. #pragma export(rectangle::rectangle(void), "createRectangle" , 10)
  83.  
  84.  
  85. /*--------------------------------------------------------*/
  86. /* Considerations: Ensure you export all the required     */
  87. /* member functions.  If an inlined or exported function  */
  88. /* uses private or protected members, you must also export*/
  89. /* those members.  In addition, you should also export    */
  90. /* all static members otherwise clients of your class will*/
  91. /* not be able to debug their code because the reference  */
  92. /* to the static data members cannot be resolved.         */
  93. /*--------------------------------------------------------*/
  94.  
  95.  
  96.