Did you also change the files in the /cbits/ folder? Because they also check for HAVE_WINSOCK_H.<br><br><div class="gmail_quote">2012/2/7 Alberto G. Corona <span dir="ltr">&lt;<a href="mailto:agocorona@gmail.com">agocorona@gmail.com</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The code is evolving and none of the versions match exactily with the<br>
patch, but substituting HAVE_WINSOCK by HAVE WINSOCK2 in these files<br>
solves the compilation problem at least in the network 2.3.0.10<br>
version from hackage.<br>
<br>
However it produces the same undefined references when this library is<br>
imported in my application. It seems that some object code is not<br>
included in the final library.  I verified that at least some of these<br>
undefined references correspond with  C code in the source, but<br>
somehow this is not included in the object library....<br>
<br>
2012/2/7 Johan Tibell &lt;<a href="mailto:johan.tibell@gmail.com">johan.tibell@gmail.com</a>&gt;:<br>
<div class="HOEnZb"><div class="h5">&gt; Note that there are two branches on github, master and stable. You want the<br>
&gt; latter.<br>
&gt;<br>
&gt; On Feb 7, 2012 8:23 AM, &quot;Alberto G. Corona&quot; &lt;<a href="mailto:agocorona@gmail.com">agocorona@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; This is quite different.<br>
&gt;&gt; I donŽt know how but I was looking at some other older patch around<br>
&gt;&gt; the same issue and I supposed that it was the one refered by Yohan<br>
&gt;&gt; Tibell.<br>
&gt;&gt;<br>
&gt;&gt; IŽll try your patch.<br>
&gt;&gt;<br>
&gt;&gt; Thanks!.<br>
&gt;&gt;<br>
&gt;&gt; 2012/2/7 Holger Reinhardt &lt;<a href="mailto:hreinhardt@gmail.com">hreinhardt@gmail.com</a>&gt;:<br>
&gt;&gt; &gt; Hi,<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; (I submitted the patch that Johan linked to)<br>
&gt;&gt; &gt; Network/Socket/Internal.hsc has the following code:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; #if defined(WITH_WINSOCK) || defined(cygwin32_HOST_OS)<br>
&gt;&gt; &gt; type CSaFamily = (#type unsigned short)<br>
&gt;&gt; &gt; #elif defined(darwin_HOST_OS)<br>
&gt;&gt; &gt; type CSaFamily = (#type u_char)<br>
&gt;&gt; &gt; #else<br>
&gt;&gt; &gt; type CSaFamily = (#type sa_family_t)<br>
&gt;&gt; &gt; #endif<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; You have patched this part to always use &#39;unsigned short&#39;. But the real<br>
&gt;&gt; &gt; issue is that WITH_WINSOCK is not defined, even though it should be. The<br>
&gt;&gt; &gt; reason for this lies in include/HsNet.h:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; #if defined(HAVE_WINSOCK_H) &amp;&amp; !defined(cygwin32_HOST_OS)<br>
&gt;&gt; &gt; # define WITH_WINSOCK  1<br>
&gt;&gt; &gt; #endif<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; The problem here is that it checks for HAVE_WINSOCK_H, but the configure<br>
&gt;&gt; &gt; script never defines this variable. Instead it defines HAVE_WINSOCK2_H.<br>
&gt;&gt; &gt; It<br>
&gt;&gt; &gt; seems that the network library used Winsock1 in the past and in the<br>
&gt;&gt; &gt; transition to Winsock2 someone forgot to change a few of the #ifdefs.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; My patch just changes all occurences of HAVE_WINSOCK_H<br>
&gt;&gt; &gt; to HAVE_WINSOCK2_H.<br>
&gt;&gt; &gt; You might want to try that and report back if it works for you.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; 2012/2/7 Alberto G. Corona &lt;<a href="mailto:agocorona@gmail.com">agocorona@gmail.com</a>&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Hi Johan,<br>
&gt;&gt; &gt;&gt; The patch is not for the current version of network and the code is<br>
&gt;&gt; &gt;&gt; quite different. Basically it is necesary to  define this variable as<br>
&gt;&gt; &gt;&gt; &quot;unsigned short&quot; that is the thing intended in the patch. however I<br>
&gt;&gt; &gt;&gt; put it by brute force, without regard of the prerpocessor directives.<br>
&gt;&gt; &gt;&gt; With this change the code compiles well with:<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; <a href="http://neilmitchell.blogspot.com/2010/12/installing-haskell-network-library-on.html" target="_blank">http://neilmitchell.blogspot.com/2010/12/installing-haskell-network-library-on.html</a><br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; However my compiled library lack the methods defined as foreign. IŽll<br>
&gt;&gt; &gt;&gt; keep trying.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; 2012/2/6 Johan Tibell &lt;<a href="mailto:johan.tibell@gmail.com">johan.tibell@gmail.com</a>&gt;:<br>
&gt;&gt; &gt;&gt; &gt; Hi,<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Someone recently contributed a fix that should make network build<br>
&gt;&gt; &gt;&gt; &gt; with<br>
&gt;&gt; &gt;&gt; &gt; 7.4: <a href="https://github.com/haskell/network/pull/25" target="_blank">https://github.com/haskell/network/pull/25</a><br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Can you see if that works for you? I haven&#39;t yet had time to merge<br>
&gt;&gt; &gt;&gt; &gt; and<br>
&gt;&gt; &gt;&gt; &gt; release that fix (I&#39;m on vacation.)<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; -- Johan<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; _______________________________________________<br>
&gt;&gt; &gt;&gt; Haskell-Cafe mailing list<br>
&gt;&gt; &gt;&gt; <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
&gt;&gt; &gt;&gt; <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
</div></div></blockquote></div><br>