home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / os / os2 / networki / 1251 < prev    next >
Encoding:
Text File  |  1992-09-08  |  3.7 KB  |  92 lines

  1. Xref: sparky comp.os.os2.networking:1251 comp.os.os2.programmer:4772
  2. Path: sparky!uunet!wupost!waikato.ac.nz!hamish
  3. From: hamish@waikato.ac.nz
  4. Newsgroups: comp.os.os2.networking,comp.os.os2.programmer
  5. Subject: Re: Accessing tcpipdll from watcom 9.0
  6. Message-ID: <1992Sep7.091120.10633@waikato.ac.nz>
  7. Date: 7 Sep 92 09:11:20 +1200
  8. References: <1992Sep3.163954.10571@waikato.ac.nz>
  9. Organization: University of Waikato, Hamilton, New Zealand
  10. Lines: 80
  11.  
  12. From:    IN%"HAMISH@waikato.ac.nz"  "Hamish Marson"  7-SEP-1992 09:07:44.49
  13. To:    hamish@waikato.ac.nz
  14. CC:    
  15. Subj:    Re: Accessing tcpipdll from watcom 9.0
  16.  
  17. Date: Mon, 7 Sep 92 09:07 +1200
  18. From: Hamish Marson <HAMISH@waikato.ac.nz>
  19. Subject: Re: Accessing tcpipdll from watcom 9.0
  20. To: hamish@waikato.ac.nz
  21. X-VMS-To: in%"hamish@waikato.ac.nz"
  22.  
  23. >> 
  24. >> I am attempting to use the tcp/ip dll from watcom C/386 9.0 under OS/2 2.0, and
  25. >> have run into a bit of a problem. After adding the __cdecl __far16 combination
  26. >> to the prototypes in the *.h files, I can get such things as sock_init() and
  27. >> socket to work and return values, consistant with what they should. However I
  28. >> can't get the gethostbyname() function to return a decent valid pointer to a
  29. >> bloick of memory (ie the host entry). I have it declared as
  30. >> 
  31. >> struct hostent * __cdecl __far16 gethostbyname(char hostname[]);
  32. >> 
  33.  
  34. Well. It turns out I'm doing it right. I just got some email from the kind
  35. person at watcom, and have been informed that it is a bug in the watcom
  36. compiler. Heres the mail message I got from him.
  37.  
  38. ***********************
  39.  
  40. I saw your posting about a problem using gethostbyname with WATCOM C.
  41. You have discovered a bug in the compiler. It refuses to believe that
  42. a function can return a __far16 pointer. I'll pass the problem on
  43. to the C front end developer. In the mean time, I've figured out
  44. a workaround for you. It's a little bit of a kludge, but it's the only
  45. way to get the right code generated. I tried a lot of variations but this
  46. was the only one that worked. Here's the code.
  47.  
  48. struct hostent * __cdecl __far16 gethostbyname(char*name);
  49. struct hostent *host;
  50.  
  51. this_works()
  52. {
  53.     struct hostent __far16 * workaround;
  54.  
  55.     *(long*)&workaround = gethostbyname("hi");
  56.     host = workaround;
  57. }
  58.  
  59. We make compiler patches available regularly. We'll be releasing patch
  60. level 'C' very soon, and I'll try to make sure that the patch solves
  61. the problem.
  62.  
  63. Patches can be downloaded from our BBS at (519) 884-2103.
  64.  
  65. Tech support can be reached at (519) 886-3700 or by sending mail to
  66. tech@watcom.on.ca. They will add you to a list of people to be
  67. notified when the patch becomes available.
  68.  
  69. Feel free to post this message to the news group if you want.
  70. I'm replying from an MS-DOS box and can't do it easily.
  71.  
  72. ***********************
  73.  
  74. Thanks to john from watcom for the info.
  75.  
  76. On another note. Are the watcom patches anywhere on the net? I don't have modem
  77. access to the states and Canada. Could some kind soul upload them to ftp-os2
  78. perhaps?
  79.  
  80.  
  81. -- 
  82. ==============================================================================
  83. |  Hamish Marson   <h.marson@waikato.ac.nz>                             OS/2 |
  84. |  Programmer (n/5), School of Computing and Mathematical Sciences           | 
  85. |  University of Waikato,                                                    |
  86. |  Hamilton, New Zealand.                                                    |
  87. |Disclaimer:  Anything said in this message is the personal opinion of the   |
  88. |             finger hitting the keyboard & doesn't represent my employers   |
  89. |             opinion in any way. (ie we probably don't agree)               |
  90. ==============================================================================
  91.   Q. If Nuclear Tests are so safe, why don't the French do them under Paris?
  92.