Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] OCaml-3.08.1/MinGW: alloc_tuple fails
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Bauer, Christoph <Christoph.Bauer@l...>
Subject: [Caml-list] OCaml-3.08.1/MinGW: alloc_tuple fails
Hi Caml-List,

I have a problem with alloc_tuple. Maybe it's a bug, maybe it's me...
A program (from the OCam'Ole package) segfaults in a alloc_tuple call.
This behavior is shown only with native compilation. Here is a small
program to reproduce the problem (OCaml 3.08.1/MinGW):

/* test.c */
#include <caml/alloc.h>
#include <caml/memory.h>

CAMLprim value test( value _ )
{
  CAMLparam1( _ );
  CAMLlocal1( t );
  int i;
  t = alloc_tuple( 100 );
  for( i=0 ; i < 100; ++i )
    Store_field( t, i, Int_val ( i ));
  CAMLreturn ( Val_unit );
}

/* test_it.ml */
external test : unit -> unit = "test"

let _ = test ()

/* compile.sh */

#!/bin/sh -v
gcc -mno-cygwin -c -shared -O  -mms-bitfields -DCAML_DLL -DDLL=1 -I
c:/ocamlmgw/lib test.cpp -D_DEBUG -g
gcc -shared -mno-cygwin -mms-bitfields -I C:/ocamlmgw/lib -o dlltest.dll
-Wl,--out-implib,libtest.a test.o c:/ocamlmgw/lib/ocamlrun.a
chmod 777 dlltest.dll
ocamlopt -ccopt dlltest.dll -ccopt -g -o test_it.exe test_it.ml
ocamlc -dllib dlltest.dll -ccopt -g -o test_it_bc.exe test_it.ml

Thanks for any help,
Christoph Bauer