Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] library dynamic loading ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: SooHyoung Oh <shoh@d...>
Subject: [Caml-list] library dynamic loading ?

Hi!

Is it possible to load library dynamically?

Here are my trials; Did I miss something or is it impossible to load library
dynamically?

(1) First,  I made toplevel system with unix library
    $ ocamlmktop -o unixtop unix.cma

(2) GOOD!!!: It's OK to execute a script
    $ cat fread

    open Unix;;

    let buffer = String.create 100 in

    let fd = openfile "demo.txt" [O_RDONLY] 0 in

    let n = read fd buffer 0 100 in

    let err = write stdout buffer 0 n in

    close fd;;

    $ unixtop fread

    Hello

(3) Fail 1: dynamic load of unix library

    $ ocaml unix.cma fread

    File "/usr/lib/ocaml/threads/unix.cma", line 1, characters 12-13:

    Illegal character (\000)

(4) Fail 2: dynamic load of library

    $ cat fread2

    #load ¡°unix.cma¡±;;

    ... (same as fread)

    $ ocaml fread2

    The external function `unix_read' is not available



--- SooHyoung Oh

-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr