Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] what magic is this?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: effbiae@i...
Subject: [Caml-list] what magic is this?
i've started writing a mmap module.  i'm looking at the source to bigarray
to see how it's done. in bigarray.ml, external functions
 Array1.{get,set} are linked to "%bigarray_{ref,set}_1"

1) what's the % -- is this what allows the fast access to the base data?
2) bigarray_ref_1 and bigarray_set_1 are not defined anywhere

hold on... greps...finds...

  bytecomp/translcore.ml:   primitives_table ... "%bigarray_ref_1" ...

aahhh.

i bet i could reuse this in my mmap module.  the question is how?

typedef struct _MM{int fd;void *map;unsigned long size;}*MM;

module Mm = struct
 type ('a,'b)t
 external create: 'a a -> 'b b -> ('a, 'b) t
 external get: ('a, 'b) t -> int -> 'a = "%bigarray_ref_1"
 external set: ('a, 'b) t -> int -> 'a -> unit = "%bigarray_set_1"
...end

any pointers greatly appreciated.


jack

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners