home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / apollo / 3370 < prev    next >
Encoding:
Text File  |  1992-08-27  |  2.6 KB  |  82 lines

  1. Path: sparky!uunet!dtix!darwin.sura.net!zaphod.mps.ohio-state.edu!sdd.hp.com!apollo.hp.com!netnews
  2. From: mishkin@apollo.HP.COM (Nathaniel Mishkin)
  3. Newsgroups: comp.sys.apollo
  4. Subject: Re: NCS: problems compiling in ANSI C
  5. Keywords: NCS
  6. Message-ID: <Btnoz5.CIA@apollo.hp.com>
  7. Date: 27 Aug 92 19:04:16 GMT
  8. References: <1992Aug26.102340.23358@ghost.dsi.unimi.it>
  9. Sender: usenet@apollo.hp.com (Usenet News)
  10. Organization: Hewlett-Packard Company - Distributed Object Computing Program / East
  11. Lines: 68
  12. Nntp-Posting-Host: mapcar.ch.apollo.hp.com
  13.  
  14. In article <1992Aug26.102340.23358@ghost.dsi.unimi.it>, giachino@ghost.dsi.unimi.it (luca giachino) writes:
  15. >You normally include these files in the manager sources,
  16. >where you actually insert the bodies of the server functions.
  17. >You might be in the need of rendering those functions invisible
  18. >to the other sources, defining them as static. In this way
  19. >the linker doesn't complain when you define different managers
  20. >for the same interface.
  21. >
  22. >But the ANSI C compiler does complain issuing a warning because
  23. >these static functions appear defined with two different prototypes:
  24. >in the include file as simple "#extern type function(type arg, ...)", 
  25. >and in the manager source as "static type function(type arg, ...)".
  26. >
  27. >Is anybody able to tell me a way for avoiding those annoing warnings?
  28.  
  29. This isn't an ideal solution, but I think it's a reasonable workaround:
  30. use the NIDL compiler "-m" switch and name your static manager routines
  31. something other than what's in the .idl file.  E.g.,
  32.  
  33.     foo.idl:
  34.  
  35.         interface foo
  36.         {
  37.             some_op(
  38.                 /* parameters */
  39.             );
  40.  
  41.             some_other_op(
  42.                 /* parameters */
  43.             );
  44.         }
  45.  
  46.     server.c:
  47.  
  48.         #include "foo.h"
  49.  
  50.         static my_some_op(/* parameters */)
  51.         {
  52.             /* manager routine body */
  53.         }
  54.  
  55.         static my_some_other_op(/* parameters */)
  56.         {
  57.             /* manager routine body */
  58.         }
  59.  
  60.         static foo_vN$epv_t my_foo_epv = {
  61.             my_some_op,
  62.             my_some_other_op
  63.         };
  64.  
  65.         main()
  66.         {
  67.             ...
  68.             rpc_$register_mgr(&uuid_$nil, &foo_vN$if_spec, 
  69.                               foo_vN$server_epv,
  70.                               (rpc_$mgr_epv_t) &my_foo_epv, &status);
  71.             ...
  72.         }
  73.  
  74. You can read the documentation for more info on the "-m" switch and
  75. rpc_$register_mgr() call.
  76.  
  77. -- 
  78.                     -- Nat Mishkin
  79.                        Distributed Object Computing Program / East
  80.                        Hewlett-Packard Company
  81.                        mishkin@apollo.hp.com
  82.