Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000094OCamlOCaml generalpublic2000-04-28 12:012000-04-28 13:40
Reporteradministrator 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000094: Re: small problem in bigarray module
DescriptionHi,

Thank you for your message to the Caml mailing list.

However your message seems to be a bug report; hence I send it to the
relevant mailing list

caml-bugs@inria.fr

Thank again for your interest in Caml.

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://cristal.inria.fr/~weis/ [^]

> Hi,
>
> I get the following behaviour in a custom toplevel with bigarray.cma
> built in:
>
> open Bigarray;;
> # let a = Array1.create float32 c_layout 4;;
> val a : (float, Bigarray.float32_elt, Bigarray.c_layout)
> Bigarray.Array1.t = <abstr>
> # a.{0} <- 2.0;;
> - : unit = ()
> # a.{0};;
> The external function `bigarray_get_1' is not available
>
> It looks as though bigarray.ml and bigarray.mli refer to
> "%bigarray_ref_1", but the C library function is called
> "bigarray_get_1". The same thing happens for Array2 and Array3 as well.
>
> Is this a bug, or have I done something wrong?
>
> Also, why do some (but not all) references to external C functions begin
> with a '%' sign? (apologies if this is in the documentation somewhere)
>
> Regards,
>
> --
> Edwin Young


TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0000362)
administrator (administrator)
2000-04-28 13:39

> > I get the following behaviour in a custom toplevel with bigarray.cma
> > built in:
> >
> > open Bigarray;;
> > # let a = Array1.create float32 c_layout 4;;
> > val a : (float, Bigarray.float32_elt, Bigarray.c_layout)
> > Bigarray.Array1.t = <abstr>
> > # a.{0} <- 2.0;;
> > - : unit = ()
> > # a.{0};;
> > The external function `bigarray_get_1' is not available
> >
> > It looks as though bigarray.ml and bigarray.mli refer to
> > "%bigarray_ref_1", but the C library function is called
> > "bigarray_get_1". The same thing happens for Array2 and Array3 as well.
> >
> > Is this a bug, or have I done something wrong?

It is a bug. I enclose a small patch that fixes it. (After applying it, go to
otherlibs/bigarrays, make all allopt, make install installopt.)

> > Also, why do some (but not all) references to external C functions begin
> > with a '%' sign? (apologies if this is in the documentation somewhere)

It's not documented. Those '%' primitives correspond to primitive operations
that are treated specially by the compiler: some of them are expanded
into machine instructions, without calling any C function; others are
either expanded into machine instructions or into a call to a generic
C function, depending on the amount of type information available.

This is the case for "%bigarray_ref_1": it may be turned into a call
to "bigarray_get_1", or expanded in-line if enough type information is
known. However, this confused the "ocamlmktop" command, which,
basically, didn't see the implicit reference to "bigarray_get_1".

Thanks for the bug report.

Best regards,

- Xavier Leroy

Index: csl/otherlibs/bigarray/bigarray.ml
diff -c csl/otherlibs/bigarray/bigarray.ml:1.5 csl/otherlibs/bigarray/bigarray.ml:1.6
*** csl/otherlibs/bigarray/bigarray.ml:1.5 Mon Feb 28 16:46:28 2000
--- csl/otherlibs/bigarray/bigarray.ml Fri Apr 28 13:32:07 2000
***************
*** 10,16 ****
  (* *)
  (***********************************************************************)
  
! (* $Id: bigarray.ml,v 1.5 2000/02/28 15:46:28 xleroy Exp $ *)
  
  (* Module [Bigarray]: large, multi-dimensional, numerical arrays *)
  
--- 10,16 ----
  (* *)
  (***********************************************************************)
  
! (* $Id: bigarray.ml,v 1.6 2000/04/28 11:32:07 xleroy Exp $ *)
  
  (* Module [Bigarray]: large, multi-dimensional, numerical arrays *)
  
***************
*** 187,190 ****
--- 187,200 ----
    if Genarray.num_dims a = 2 then a else invalid_arg "Bigarray.array2_of_genarray"
  let array3_of_genarray a =
    if Genarray.num_dims a = 3 then a else invalid_arg "Bigarray.array3_of_genarray"
+
+ (* Force bigarray_get_{1,2,3,N} to be linked in, since we don't refer
+ to those primitives directly in this file *)
+
+ let _ =
+ let getN = Genarray.get in
+ let get1 = Array1.get in
+ let get2 = Array2.get in
+ let get3 = Array3.get in
+ ()
  

(0000363)
administrator (administrator)
2000-04-28 13:40

Fixed on 2000-04-28 by Xavier.

- Issue History
Date Modified Username Field Change
2005-11-18 10:13 administrator New Issue


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker