caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* AW: [Caml-list] segfault in caml_copy_string
@ 2004-07-16 14:39 Bauer, Christoph
  0 siblings, 0 replies; only message in thread
From: Bauer, Christoph @ 2004-07-16 14:39 UTC (permalink / raw)
  To: caml-list

[-- 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 --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-07-16 14:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-16 14:39 AW: [Caml-list] segfault in caml_copy_string Bauer, Christoph

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).