From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 63C2ABC84 for ; Tue, 22 Mar 2005 16:33:06 +0100 (CET) Received: from smtp6.wanadoo.fr (smtp6.wanadoo.fr [193.252.22.25]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j2MFX6Gg011099 for ; Tue, 22 Mar 2005 16:33:06 +0100 Received: from me-wanadoo.net (unknown [127.0.0.1]) by mwinf0601.wanadoo.fr (SMTP Server) with ESMTP id E7B4F1C00262 for ; Tue, 22 Mar 2005 16:33:05 +0100 (CET) Received: from nono (ARouen-106-1-38-135.w80-14.abo.wanadoo.fr [80.14.203.135]) by mwinf0601.wanadoo.fr (SMTP Server) with SMTP id 459CF1C00261 for ; Tue, 22 Mar 2005 16:33:05 +0100 (CET) X-ME-UUID: 20050322153305285.459CF1C00261@mwinf0601.wanadoo.fr Message-ID: <002b01c52ef4$c6de9120$87cb0e50@mshome.net> From: =?iso-8859-1?Q?Fr=E9d=E9ric_Gava?= To: Subject: Pb "interface C <-> Ocaml" with array of string Date: Tue, 22 Mar 2005 16:35:28 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Miltered: at nez-perce with ID 42403AB2.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; gava:01 gava:01 ocaml:01 caml-list:01 threads:01 threads:01 initializing:01 char:01 argv:01 ocaml:01 argv:01 argc:01 camlparam:01 alloc:01 argc:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: Dear Caml-List, I have a problem with an initialization of a array of strings using a C procedure. I give you the code with some comments. My code works well without threads but when I add some threads to my code the array is initializing with some strange strings. If someone could help me... Thanks, Frédéric Gava char **argv; /* "arguments" is the Ocaml Sys.argv array */ value bsmlpub_init(value arguments) { int argc,i; CAMLparam1(arguments); /* alloc the arguments */ argc = Wosize_val(arguments); argv = (char**)stat_alloc((argc + 1) * sizeof(char *)); for (i = 0; i < argc; i++) argv[i] = String_val(Field(arguments, i)); argv[i] = NULL; /* saving them */ /* This function is a C function take from a special library for parallel computing. So it is impossible to modified this function. This function gives to all processors the same parameters take from the line command of the bash. */ bsplib_saveargs(&argc, &argv); CAMLreturn (Val_unit); } /* Them, when a program wants to read the parameters, it calls this functions, but here I have an array with bad strings.... */ value bsmlpub_argv(value unit) { CAMLparam1(unit); CAMLreturn (copy_string_array(argv)); }