[Caml-list] ICFP '10: Final call for participation

2010-08-23 Thread Wouter Swierstra
= Final Call for Participation The 15th ACM SIGPLAN International Conference on Functional Programming (ICFP 2010) http://www.icfpconference.org/icfp2010/

[Caml-list] Segfaults with Dynlink with OCaml 3.11

2010-08-23 Thread Paul Steckler
I'm getting segmentation faults when using dynamically linked native code in 64-bit OCaml 3.11 running on Linux (Fedora 12 x64). The .cmxs file loads fine. There's a glue module that's "open"d in the code for the dynamic module, and linked against the main program. The dynamic module calls funct

Re: [Caml-list] Segfaults with Dynlink with OCaml 3.11

2010-08-23 Thread Stéphane Glondu
Le 23/08/2010 12:57, Paul Steckler a écrit : > I'm getting segmentation faults when using dynamically linked native > code in 64-bit OCaml 3.11 running > on Linux (Fedora 12 x64). [...] > I've written some small example programs with a similar structure, and > those work just fine. In my real, > l

Re: [Caml-list] Segfaults with Dynlink with OCaml 3.11

2010-08-23 Thread Paul Steckler
On Mon, Aug 23, 2010 at 9:06 PM, Stéphane Glondu wrote: > Does your real large program use C bindings? Are you able to reproduce > the segfaults with pure OCaml code? Yes, the large program has C bindings, including calls into dynamically loaded .so files (Linux dynamic libraries). Anything I sh

Re: [Caml-list] Segfaults with Dynlink with OCaml 3.11

2010-08-23 Thread Mark Shinwell
On Mon, Aug 23, 2010 at 09:47:43PM +1000, Paul Steckler wrote: > On Mon, Aug 23, 2010 at 9:06 PM, Stéphane Glondu wrote: > > Does your real large program use C bindings? Are you able to reproduce > > the segfaults with pure OCaml code? > > Yes, the large program has C bindings, including calls in

Re: [Caml-list] Question about float refs.

2010-08-23 Thread Christophe TROESTLER
On Thu, 19 Aug 2010 07:52:33 -0400, Ethan Burns wrote: > > let r = ref 0.0 ;; > for i = 0 to 10 do r := float i done; > Printf.printf "%f\n" !r; > Printf.printf "words: %f\n" (Gc.stat ()).Gc.minor_words To add a precision to others' answers : float refs are unboxed _locally_. If you rewr

Re: [Caml-list] caml_copy_string

2010-08-23 Thread Florent Monnier
Le dimanche 22 août 2010 01:30:28, Jeffrey Barber a écrit : > Is there a way to get a string from C to OCaml without the caml_copy_string > function, or is there a version that doesn't copy the string? an alternative method is to provide a string from ocaml to c then c fills this buffer, then you

Re: [Caml-list] Segfaults with Dynlink with OCaml 3.11

2010-08-23 Thread Paul Steckler
On Mon, Aug 23, 2010 at 10:05 PM, Mark Shinwell wrote: > It can be a time-consuming task, but double-check all the rules on > http://caml.inria.fr/pub/docs/manual-ocaml/manual032.html are being followed. > For example, watch out for things like variables of type [value] that are > wrongly not prot

Re: [Caml-list] Question about float refs.

2010-08-23 Thread Ethan Burns
On Mon, Aug 23, 2010 at 8:06 AM, Christophe TROESTLER wrote: > On Thu, 19 Aug 2010 07:52:33 -0400, Ethan Burns wrote: >> >> let r = ref 0.0 ;; >> for i = 0 to 10 do r := float i done; >> Printf.printf "%f\n" !r; >> Printf.printf "words: %f\n" (Gc.stat ()).Gc.minor_words > > To add a precis

Re: [Caml-list] Segfaults with Dynlink with OCaml 3.11

2010-08-23 Thread Daniel Bünzli
Here are also a few tips (also in the comments) to chase that bug. http://rwmj.wordpress.com/2010/01/22/tip-tracking-down-ocaml-heap-corruptors/ Daniel ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/

Re: [Caml-list] Segfaults with Dynlink with OCaml 3.11

2010-08-23 Thread Anil Madhavapeddy
On 23 Aug 2010, at 13:12, Paul Steckler wrote: > On Mon, Aug 23, 2010 at 10:05 PM, Mark Shinwell > wrote: > >> Have you tried using gdb to determine the stack backtrace when it segfaults? >> Also, if it can be done without disturbing too much code, it might be worth >> trying to eliminate Dynlin

[Caml-list] Re: Question about float refs.

2010-08-23 Thread Sylvain Le Gall
On 23-08-2010, Ethan Burns wrote: > On Mon, Aug 23, 2010 at 8:06 AM, Christophe TROESTLER > wrote: >> On Thu, 19 Aug 2010 07:52:33 -0400, Ethan Burns wrote: >>> >>> let r = ref 0.0 ;; >>> for i = 0 to 10 do r := float i done; >>> Printf.printf "%f\n" !r; >>> Printf.printf "words: %f\n" (Gc

Re: [Caml-list] caml_copy_string

2010-08-23 Thread Stéphane Glondu
Le 23/08/2010 14:09, Florent Monnier a écrit : >> Is there a way to get a string from C to OCaml without the caml_copy_string >> function, or is there a version that doesn't copy the string? > > an alternative method is to provide a string from ocaml to c then c fills > this > buffer, then you c

Re: [Caml-list] Re: Question about float refs.

2010-08-23 Thread Dmitry Bely
On Mon, Aug 23, 2010 at 4:42 PM, Sylvain Le Gall wrote: > On 23-08-2010, Ethan Burns wrote: >> On Mon, Aug 23, 2010 at 8:06 AM, Christophe TROESTLER >> wrote: >>> On Thu, 19 Aug 2010 07:52:33 -0400, Ethan Burns wrote: let r = ref 0.0 ;; for i = 0 to 10 do r := float i done;

Re: [Caml-list] caml_copy_string

2010-08-23 Thread Florent Monnier
Le lundi 23 août 2010 14:59:19, Stéphane Glondu a écrit : > Le 23/08/2010 14:09, Florent Monnier a écrit : > >> Is there a way to get a string from C to OCaml without the > >> caml_copy_string function, or is there a version that doesn't copy the > >> string? > > > > an alternative method is to pr

Re: [Caml-list] Converting variants with only constant constructors to integers

2010-08-23 Thread Damien Doligez
Hi Kaustuv, On 2010-06-08, at 20:22, Kaustuv Chaudhuri wrote: >> Of course intify can cause a segmentation fault! >> >> # let arr = Array.of_list [intify 1.0; 0];; >> Segmentation fault > > This may be splitting hairs, but the reason that fails is that > Array.of_list's ad hoc polymorphism heur

Re: [Caml-list] Segfaults with Dynlink with OCaml 3.11

2010-08-23 Thread Stéphane Glondu
Le 23/08/2010 14:12, Paul Steckler a écrit : > [...] > Oh, we just added the Dynlink stuff. There haven't been any recent > crashes until > just now. That could be an unhappy coincidence; the real issue might > lurk in unrelated > code, as you point out. Note that Dynlink can point out bugs (eve

Re: [Caml-list] caml_copy_string

2010-08-23 Thread Romain Beauxis
Le lundi 23 août 2010 07:09:05, Florent Monnier a écrit : > an alternative method is to provide a string from ocaml to c then c fills > this buffer, then you can save allocations by reusing the same buffer, > see: This is a good idea but I would be a little bit suspicious about using "noalloc".

Re: [Caml-list] node.ocaml

2010-08-23 Thread Jake Donham
On Sat, Aug 21, 2010 at 8:27 PM, Jeffrey Barber wrote: > example code: > http://github.com/mathgladiator/node.ocaml/blob/master/test/kvp.ml Have you considered using Lwt (http://ocsigen.org/lwt) as a layer on top of raw continuation-passing style? It has a lot of nice functions for writing asynch

Re: [Caml-list] Delimited continuations in OCaml go to 3.12 and 64

2010-08-23 Thread Yoann Padioleau
Is there any tutorial on why such features are useful ? Concrete examples of their use. For instance can you implement python generators and its yield stuff by using this library ? The only reference mentioned in the source is a technical report that does not look very easy to read. On Aug 22, 2

Re: [Caml-list] node.ocaml

2010-08-23 Thread Jeffrey Barber
Hello, No I haven't, thanks for the link. In looking through the docs, it seems similiar at some level to what I am doing. I'm trying to get away from the language of threading (In my code, I use chain and io_pumps for context storage) since I'm thinking of node.ocaml as an event based io library.

Re: [Caml-list] node.ocaml

2010-08-23 Thread Gerd Stolpmann
You may also look at ocamlnet (http://projects.camlcity.org/projects/ocamlnet.html), which provides a stack of abstractions for event-driven programming: - The Netsys library defines an object type for sets of file descriptors one can poll: http://projects.camlcity.org/projects/dl/ocamlnet-3.0t

Re: [Caml-list] Delimited continuations in OCaml go to 3.12 and 64

2010-08-23 Thread Jake Donham
On Mon, Aug 23, 2010 at 2:38 PM, Yoann Padioleau wrote: > Is there any tutorial on why such features are useful ? > Concrete examples of their use. For instance can you implement > python generators and its yield stuff by using this library ? Here is an example of a particular use of Delimcc to i

[Caml-list] Generators in OCaml

2010-08-23 Thread oleg
Yoann Padioleau wrote: > Is there any tutorial on why such features are useful ? > Concrete examples of their use. Thank you for the question! I think you may find many examples of delimited continuations on the following web site: http://okmij.org/ftp/Computation/Continuations.html Nota