home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / cplus / 18748 < prev    next >
Encoding:
Text File  |  1993-01-06  |  3.2 KB  |  98 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!wupost!darwin.sura.net!jvnc.net!newserver.jvnc.net!newsserver.technet.sg!nuscc!papaya!suresh
  3. From: suresh@papaya.iss.nus.sg (Suresh Thennarangam - Research Scholar)
  4. Subject: C++/X11/Motif Problems
  5. Message-ID: <1993Jan6.130916.9037@nuscc.nus.sg>
  6. Originator: suresh@papaya
  7. Sender: usenet@nuscc.nus.sg
  8. Organization: Institute Of Systems Science, NUS
  9. Date: Wed, 6 Jan 1993 13:09:16 GMT
  10. Lines: 86
  11.  
  12. Hi netters:
  13.  
  14. I am using cfront3.0  on SGI, X11R4 and Motif 1.1.
  15.  
  16. I have these problems .. I hope someone can help. 
  17.  
  18. Briefly:
  19.  
  20.  
  21.  
  22. 1>  Here is an excerpt from the file /usr/include/X11/ShellP.h
  23.  
  24. ================================
  25. typedef struct {
  26.     char *class; // -----> note this
  27.     XrmClass xrm_class;
  28.     int argc;
  29.     char **argv;
  30. } ApplicationShellPart;
  31. ================================
  32.  
  33. Note that there is a member declared by the name class which is a
  34. C++ reserved word. The X11 and Motif release header files contain
  35. several such code fragments which will prevent code from passing thro'
  36. the C++ compiler. Does anyone know any solution or workaround for this
  37. problem ?
  38.  
  39. 2> 
  40. I have some source lines in my program like so, 
  41.  
  42. #include    <Mrm/MrmAppl.h>
  43. :
  44. :
  45. :
  46.         if ( MrmRegisterClass ( MrmwcUnknown,
  47.                                 "GlxMDraw" ,
  48.                                 "GlxCreateMDraw",
  49.                                 GlxCreateMDraw,
  50.                                 glxMDrawWidgetClass ) != MrmSUCCESS )
  51.             XtAppError( app_context, "Can't register GL widget.");
  52. ----------------------
  53.  
  54. If I compile this source the compiler says:
  55.  
  56. ==============================================================
  57.  
  58. "iface2.c", line 89: error: bad argument  4 type for 
  59. MrmRegisterClass(): Widget( *)(Widget, char *, ArgList, Cardinal) 
  60. ( Widget(*)() expected)
  61. *** Error code 1
  62.  
  63. ==============================================================
  64.  
  65. How do I resolve this problem ? Do I just cast away like so ?
  66.  
  67. if ( MrmRegisterClass ( MrmwcUnknown,
  68.                                 "GlxMDraw" ,
  69.                                 "GlxCreateMDraw",
  70.                                 ((Widget(*)()) GlxCreateMDraw ,
  71.                                 GlxCreateMDraw,
  72.                                 glxMDrawWidgetClass ) != MrmSUCCESS )
  73.             XtAppError( app_context, "Can't register GL widget.");
  74.  
  75.  
  76. This compiles but I'm not sure if it will cause any other problems.
  77.  
  78. In fact several functions accept pointer to function arguments 
  79. and the compiler always insists on checking if the argument types
  80. match .. isn't this rather unneccessary ? 
  81.  
  82.  
  83. Thanks,
  84.  
  85.       __                  
  86.      (_   / /  o_   o  o |_
  87.      __)/(_( __) (_(_ /_)| )_
  88.  
  89.  
  90. ***************************************************************************
  91. * Suresh Thennarangam               *  EMail: suresh@iss.nus.sg(Internet) *
  92. * Research Scholar                  *         ISSST@NUSVM.BITNET          *
  93. * Institute Of Systems Science      *  Tel:  (065) 772 2588.              *
  94. * National University Of Singapore  *  Facs.: (065) 778 2571              *
  95. * Heng Mui Keng Terrace             *  Telex: ISSNUS RS 39988             *
  96. * Singapore 0511.                   *                                     *
  97. ***************************************************************************
  98.