Version française
Home     About     Download     Resources     Contact us    
Browse thread
Ocamlnet and EINPROGRESS
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Yitzhak Mandelbaum <yitzhak@r...>
Subject: Re: [Caml-list] Ocamlnet and EINPROGRESS
Its a little more complicated than that. The problem arises when  
linking with 1) a library that links with Unix and 2) a file that  
depends on Unix. I've found a minimal example that fails on my system  
(OS X). It involves 4 files: Makefile, mintime.ml, unixprog.ml,  
minprog.ml (names chosen arbitrarily):

########################
Makefile:
########################

all: minprog

timelib.cma: mintime.ml
	ocamlfind ocamlc -package unix -linkpkg \
	-o $@ -a mintime.ml

minprog: timelib.cma  unixprog.ml
	ocamlfind ocamlc $(INCLUDES) -thread -o $@ \
	-package netclient -linkpkg $^ minprog.ml


########################
mintime.ml:
#######################

let now () = Unix.time ()

########################
unixprog.ml:
#######################

let foo x =
   let in_channel, out_channel = Unix.open_process "cat" in
   let read_fd = Unix.descr_of_in_channel in_channel in
   let write_fd = Unix.descr_of_out_channel out_channel in
   ()

########################
minprog.ml:
#######################

let mystring = Http_client.Convenience.http_get "http://www.cnn.com"


Then,

make minprog
./minprog

results in

Fatal error: exception Unix.Unix_error(38, "connect", "")

Yitzhak

On Apr 2, 2008, at 10:30 PM, Eric Cooper wrote:

> On Wed, Apr 02, 2008 at 10:08:55PM -0400, Yitzhak Mandelbaum wrote:
>>    Sure, here's one:
>>
>>    let mystring = Http_client.Convenience.http_get "http:// 
>> www.cnn.com"
>>
>>    But, whether or not it raises the exception depends what I link it
>>    with, which is the essential problem.
>
> On my (Debian) system, I can't build that program without linking in
> the Unix module, since it's referenced by almost all of the ocamlnet
> modules.   So I don't understand the problem you're seeing.
>
> -- 
> Eric Cooper             e c c @ c m u . e d u
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

--------------------------------------------------
Yitzhak Mandelbaum
AT&T Labs - Research

http://www.research.att.com/~yitzhak