RE: [Caml-list] Exception values may crash GC when interfacing C and Caml

2012-05-02 Thread David Allsopp
Alexey Rodriguez wrote: Dear all, We are experiencing crashes in Caml-calling C code. This happens if garbage collection runs after Caml code has raised an exception. We now understand why this happens but we are puzzled as to why the Interfacing C with Ocaml chapter of the Ocaml manual

RE: [Caml-list] Re: New version of the binary installer for Windows

2012-04-02 Thread David Allsopp
Romain Bardou wrote: Le 30/03/2012 16:15, Jonathan Protzenko a écrit : Hi again, Following all the good suggestions in this thread, I've updated the installer. It now downloads and runs cygwin's setup.exe so as to provide a fully working environment for OCaml on windows after the

RE: [Caml-list] How could I implement an efficient ring buffer?

2012-04-02 Thread David Allsopp
Hongbo Zhang wrote: Hi List, I want to implement sliding window algorithm (in place, no memory copy), I wonder whether I need to write c code. To make it clear and simple, In c, you can record the head pointer of the array, and do the modulo operations when get and set

RE: [Caml-list] New version of the binary installer for Windows

2012-03-28 Thread David Allsopp
Wojciech Meyer wrote: Hi Jonathan, Thanks for the installer! On Wed, Mar 28, 2012 at 4:19 PM, Jonathan Protzenko jonathan.protze...@gmail.com wrote: Unfortunately, ocamlbuild requires a unix-like environment, with a few utilities in the path: bash, mkdir... It looks like he's got a

RE: [Caml-list] Re: [oss-security] CVE request: Hash DoS vulnerability (ocert-2011-003)

2012-03-13 Thread David Allsopp
Dario Teixeira wrote: Hi, Basically I like the idea of teaching users this way. The typical user will understand the impact, and act accordingly. Nevertheless, I would like it if it would be made as easy as possible to provide good seeds if required. The Random module is definitely

RE: [Caml-list] [community poll for PR#5312] Do some OCaml Windows users still use the @responsefile feature?

2012-03-05 Thread David Allsopp
Gabriel Scherer wrote: In the process of discussing bug #5312, the caml team would like to know if people still have use of the @responsefile feature under windows. If not, it could be removed from the runtime -- that is from all OCaml programs.

RE: [Caml-list] Latest OCaml + Libraries on CentOS

2012-02-27 Thread David Allsopp
Francois Berenger wrote: On 02/26/2012 07:49 PM, David Allsopp wrote: I've comparatively recently upgraded from an embarrassingly old version of Fedora to CentOS 6.2. With only the default repositories enabled, the version of OCaml and number of packages available are a bit limited

[Caml-list] Latest OCaml + Libraries on CentOS

2012-02-26 Thread David Allsopp
I've comparatively recently upgraded from an embarrassingly old version of Fedora to CentOS 6.2. With only the default repositories enabled, the version of OCaml and number of packages available are a bit limited (especially compared with Fedora). Before I go ahead and just build what I want from

[Caml-list] Windows problem with Unix.open_connection

2012-02-24 Thread David Allsopp
I'm in the process of eliminating any customisations I might have in place, but do any other Windows users get the following unexpected result with Unix.open_connection running MinGW-w64 OCaml 3.12.1? # let (i, o) = Unix.open_connection (Unix.ADDR_INET (Unix.inet_addr_of_string 173.194.67.104,

RE: [Caml-list] Compiling Cryptokit on Windows

2012-02-06 Thread David Allsopp
Romain Bardou wrote: Hi list, There has been some discussion during the last few months were some argued that there was not enough Windows users to test libraries. Well it happens that I need to compile Cryptokit for Windows. Here are my first results, which failed miserably. I'm using

RE: [Caml-list] is there a more concise way to write this?

2012-01-20 Thread David Allsopp
Valentin ROBERT wrote: I guess you can write it like: let a = (if out then [o] else []) @ (if value then [v] else []) But it's not particularly more pleasant to the eye. Still it reduces the exponential explosion of the code, at a small additional cost (the @), I believe. Actually, it's

RE: [Caml-list] is there a more concise way to write this?

2012-01-20 Thread David Allsopp
Edgar Friendly wrote: On 01/20/2012 03:37 AM, David Allsopp wrote: Actually, it's possible that with more cases it might be faster - it's eliminating the allocation (at some point) of all the tuples needed for the match case, Doesn't the ocaml compiler not allocate the unnecessary tuples

RE: [Caml-list] Examples where let rec is undesirable

2012-01-06 Thread David Allsopp
ivan chollet wrote: Sorry Richard I should have elaborated a bit more. I guess there are a couple of examples in the literature, but one of them comes to my mind, consider the following code snippet: let fd = Unix.open myfile1 ... in let fd = Unix.open myfile2 ... in ... (some code)

RE: [Caml-list] Hashtbl and security

2011-12-30 Thread David Allsopp
Yaron Minsky wrote: For just this reason, the hashtables in Core have been reimplemented to use an AVL tree in the buckets.  That way, even when you have pathological collisions, you degrade gracefully to O(log n) per operation, instead of O(n), where n is the number of keys in the

RE: [Caml-list] ocamlbuild sources?

2011-11-11 Thread David Allsopp
Philip wrote: Hi, i obviously missed something, but where can i download current ocamlbuild sources? They're in the main OCaml sources tarball (or SVN, therefore) in the ocamlbuild directory David -- Caml-list mailing list. Subscription management and archives:

RE: [Caml-list] separate compilation

2011-09-09 Thread David Allsopp
Walter Cazzola wrote: Hi, thanks Cedric i got the point, I can separate interface from the implementation but: The main point of interfaces is to constrain the inferred interface of a module (e.g. hide functions or types which shouldn't be exposed to another module or constraint polymorphic

RE: [Caml-list] Cross-platform cpu count

2011-09-02 Thread David Allsopp
malc wrote: On Fri, 2 Sep 2011, Daniel Bünzli wrote: Hello, Can anybody confirm me that the following code works on cygwin : It won't - Sys.os_type returns Cygwin and getconf isn't in Cygwin either - http://cygwin.com/ml/cygwin/2010-12/msg00435.html (actually, it may be now - I haven't

RE: [Caml-list] Cross-platform cpu count

2011-09-02 Thread David Allsopp
Richard W.M. Jones wrote: On Fri, Sep 02, 2011 at 02:04:51AM +0200, Daniel Bünzli wrote: Hello, Can anybody confirm me that the following code works on cygwin : let cpu_count () = try match Sys.os_type with | Win32 - int_of_string (Sys.getenv NUMBER_OF_PROCESSORS) | _ -

[Caml-list] Module design

2011-08-20 Thread David Allsopp
I'm working on a new version of a framework for a server daemon which can have custom functionality plugged in through different backends. The present version works by passing a record containing lots of options along the lines of: type backend = {b_connect: (connectionID - bool) option;

RE: [Caml-list] Module design

2011-08-20 Thread David Allsopp
*) end -Cheers Pierre Selon David Allsopp dra-n...@metastack.com: I'm working on a new version of a framework for a server daemon which can have custom functionality plugged in through different backends. The present version works by passing a record containing lots of options

RE: [Caml-list] Trying to setup mingw OCaml 3.12.1 + fresh cygwin

2011-08-12 Thread David Allsopp
Adrien Nader wrote: On 10/08/2011, Matthieu Dubuget matthieu.dubu...@gmail.com wrote: Date: 10/08/2011 10:25 From: David Allsopp dra-n...@metastack.com wrote: Good to know that 64-bit MinGW is working - that said, I thought the MinGW port was broken in 3.12.1 or is that not affected

RE: [Caml-list] Val_int vs caml_copy_nativeint

2011-08-09 Thread David Allsopp
Erik de Castro Lopo wrote: Xavier Leroy wrote: On 08/08/2011 10:03 AM, Guillaume Yziquel wrote: Then I do not see anything wrong if the code snippet you sent. However, when you change Val_int to caml_copy_nativeint, the layout of the tuple is different. [...] So if you keep the

RE: [Caml-list] Val_int vs caml_copy_nativeint

2011-08-09 Thread David Allsopp
malc wrote: On Tue, 9 Aug 2011, David Allsopp wrote: Erik de Castro Lopo wrote: Xavier Leroy wrote: On 08/08/2011 10:03 AM, Guillaume Yziquel wrote: Then I do not see anything wrong if the code snippet you sent. However, when you change Val_int to caml_copy_nativeint

[Caml-list] Unix.file_descr and unixsupport.h

2011-08-02 Thread David Allsopp
OK, some further digging into my problem with ocaml-ssl eventually revealed that the problem is the way it handles Unix.file_descr. On Unix, this is just an [int] and so ocaml-ssl's stubs treat it as such. Under Windows, it's a custom block as file_descr is a C struct containing a lot of

[Caml-list] Writing to a blocked socket

2011-08-02 Thread David Allsopp
I don't seem to be able to ask Google this in a way which will give me a reasonable answer! In the same process, if you have one thread blocked on a [recv] operation on a socket, under Unix another thread can still write to the socket. Under Windows, however, the call to [send] blocks because

RE: [Caml-list] Writing to a blocked socket

2011-08-02 Thread David Allsopp
I just translated that OCaml example to C and it works correctly under Windows which suggests it's a bug in OCaml... so I'll attach that ML file to a Mantis report, instead! David Allsopp wrote: Gerd Stolpmann wrote: Am Dienstag, den 02.08.2011, 18:01 +0100 schrieb David Allsopp: I don't