caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Bauer, Christoph" <Christoph.Bauer@lms-gmbh.de>
To: caml-list@inria.fr
Subject: AW: [Caml-list] segfault in caml_copy_string
Date: Fri, 16 Jul 2004 16:39:06 +0200	[thread overview]
Message-ID: <D981925B4F2CD611870300E0184CEE9B0157F215@kaiserslautern1.lms-gmbh.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 763 bytes --]

> 
> caml_copy_string actually allocates a *garbage-collected* 
> string, so you need to tell about its result to the GC. Try instead
> 
>  CAMLprim value getparam(value request, value key){
>    CAMLparam2(request, key);
>    CAMLlocal1(result);
>    result = caml_copy_string("test");
>    CAML_return(result);
> }
> 
> (to understand why, read any material on precise moving garbage
> collectors)

Thanks for the fast response.
But ocaml/stdlib/sys.c contains this function:

CAMLprim value caml_sys_getenv(value var)
{
  char * res;

  res = getenv(String_val(var));
  if (res == 0) caml_raise_not_found();
  return caml_copy_string(res);
}

I found out that it is a links problem because of mixing a 
static library and a DLL.

best regards,
Christoph Bauer

[-- Attachment #2: Type: text/html, Size: 1845 bytes --]

                 reply	other threads:[~2004-07-16 14:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=D981925B4F2CD611870300E0184CEE9B0157F215@kaiserslautern1.lms-gmbh.de \
    --to=christoph.bauer@lms-gmbh.de \
    --cc=caml-list@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).