From: "Frédéric Gava" <gava@univ-paris12.fr>
To: <caml-list@yquem.inria.fr>
Subject: Pb "interface C <-> Ocaml" with array of string
Date: Tue, 22 Mar 2005 16:35:28 +0100 [thread overview]
Message-ID: <002b01c52ef4$c6de9120$87cb0e50@mshome.net> (raw)
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));
}
next reply other threads:[~2005-03-22 15:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-22 15:35 Frédéric Gava [this message]
2005-03-22 16:19 ` [Caml-list] " Olivier Andrieu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='002b01c52ef4$c6de9120$87cb0e50@mshome.net' \
--to=gava@univ-paris12.fr \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).