caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] library dynamic loading ?
@ 2001-09-12  4:53 SooHyoung Oh
  2001-09-12  7:15 ` Sven
  0 siblings, 1 reply; 2+ messages in thread
From: SooHyoung Oh @ 2001-09-12  4:53 UTC (permalink / raw)
  To: caml-list


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


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

* Re: [Caml-list] library dynamic loading ?
  2001-09-12  4:53 [Caml-list] library dynamic loading ? SooHyoung Oh
@ 2001-09-12  7:15 ` Sven
  0 siblings, 0 replies; 2+ messages in thread
From: Sven @ 2001-09-12  7:15 UTC (permalink / raw)
  To: SooHyoung Oh; +Cc: caml-list

On Wed, Sep 12, 2001 at 01:53:15PM +0900, SooHyoung Oh wrote:
> 
> Hi!
> 
> Is it possible to load library dynamically?
> 
> Here are my trials; Did I miss something or is it impossible to load library
> dynamically?

It is already implemented in ocaml 3.03, but not currently in 3.02. In the
meantime, you have to build a custom toplevel, as explained in the docs.

Friendly,

Sven Luther
-------------------
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


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

end of thread, other threads:[~2001-09-12  7:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-12  4:53 [Caml-list] library dynamic loading ? SooHyoung Oh
2001-09-12  7:15 ` Sven

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