caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] what magic is this?
@ 2004-08-04  7:27 effbiae
  2004-08-05 16:00 ` David Monniaux
  0 siblings, 1 reply; 3+ messages in thread
From: effbiae @ 2004-08-04  7:27 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-08-06 11:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-04  7:27 [Caml-list] what magic is this? effbiae
2004-08-05 16:00 ` David Monniaux
2004-08-06 11:10   ` Jack Andrews

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