caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* RE: [Caml-list] ocamlmktop mystery
@ 2005-11-18 12:50 EL CHAAR Rabih   SGAM/AI/SAM
  2005-11-18 13:35 ` Florian Weimer
  0 siblings, 1 reply; 3+ messages in thread
From: EL CHAAR Rabih   SGAM/AI/SAM @ 2005-11-18 12:50 UTC (permalink / raw)
  To: Florian Weimer, caml-list

The interface file is still in the lib directory.
you should do the follwing :
#directory "../lib";;
# Foo.add;;


The toplevel has to see the interface files .cmi in order to get the types, since this infomation is not in the compiled .cmo or .cmx.


Rabih


-----Message d'origine-----
De : caml-list-bounces@yquem.inria.fr
[mailto:caml-list-bounces@yquem.inria.fr]De la part de Florian Weimer
Envoyé : vendredi 18 novembre 2005 13:46
À : caml-list@yquem.inria.fr
Objet : [Caml-list] ocamlmktop mystery


[Repost from comp.lang.functional]

I can't use ocamlmktop to build a toplevel using objects in a
different directory:

$ mkdir lib
$ echo let add a b = a + b > lib/foo.ml
$ ocamlc -c lib/foo.ml
$ ocamlmktop -I lib lib/foo.cmo
$ ./a.out
        Objective Caml version 3.08.3

# Foo.add;;
Unbound value Foo.add
# 

However, changing to the directory first works as expected:

$ cd lib
$ ocamlmktop foo.cmo
$ /a.out
        Objective Caml version 3.08.3

# Foo.add;;
- : int -> int -> int = <fun>
# 

What am I doing wrong?

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs
*************************************************************************
Ce message et toutes les pieces jointes (ci-apres le "message") sont confidentiels et etablis a l'intention exclusive de ses
destinataires.
Toute utilisation ou diffusion non autorisee est interdite. 
Tout message electronique est susceptible d'alteration. 
SG Asset Management et ses filiales declinent toute responsabilite au titre de ce message s'il a ete altere, deforme ou falsifie.

Decouvrez l'offre et les services de SG Asset Management sur le site www.sgam.fr 

                                ********

This message and any attachments (the "message") are confidential and intended solely for the addressees.
Any unauthorised use or dissemination is prohibited. 
E-mails are susceptible to alteration. 
Neither SG Asset Management nor any of its subsidiaries or affiliates shall be liable for the message if altered, changed or
falsified. 

*************************************************************************


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

* Re: [Caml-list] ocamlmktop mystery
  2005-11-18 12:50 [Caml-list] ocamlmktop mystery EL CHAAR Rabih   SGAM/AI/SAM
@ 2005-11-18 13:35 ` Florian Weimer
  2005-11-18 18:25   ` Martin Jambon
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Weimer @ 2005-11-18 13:35 UTC (permalink / raw)
  To: EL CHAAR Rabih SGAM/AI/SAM; +Cc: caml-list

* EL CHAAR Rabih:

> The interface file is still in the lib directory.
> you should do the follwing :
> #directory "../lib";;
> # Foo.add;;
>
> The toplevel has to see the interface files .cmi in order to get the
> types, since this infomation is not in the compiled .cmo or .cmx.

Ah, this explains it.  Thanks a lot.

Is there some way to hard-code the paths in the binary (or include the
.cmi files themselves)?  Currently, I use Topdirs.dir_directory to set
the directories, which seems to work, but smells a bit like abusing an
internal interface.


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

* Re: [Caml-list] ocamlmktop mystery
  2005-11-18 13:35 ` Florian Weimer
@ 2005-11-18 18:25   ` Martin Jambon
  0 siblings, 0 replies; 3+ messages in thread
From: Martin Jambon @ 2005-11-18 18:25 UTC (permalink / raw)
  To: Florian Weimer; +Cc: EL CHAAR Rabih SGAM/AI/SAM, caml-list

On Fri, 18 Nov 2005, Florian Weimer wrote:

> * EL CHAAR Rabih:
>
>> The interface file is still in the lib directory.
>> you should do the follwing :
>> #directory "../lib";;
>> # Foo.add;;
>>
>> The toplevel has to see the interface files .cmi in order to get the
>> types, since this infomation is not in the compiled .cmo or .cmx.
>
> Ah, this explains it.  Thanks a lot.
>
> Is there some way to hard-code the paths in the binary (or include the
> .cmi files themselves)?  Currently, I use Topdirs.dir_directory to set
> the directories, which seems to work, but smells a bit like abusing an
> internal interface.

You can create a script like:

#!/bin/sh
exec the_toplevel -I the_directory


Martin

--
Martin Jambon, PhD       http://martin.jambon.free.fr

   Integrated Regexps       http://martin.jambon.free.fr/micmatch.html
   Bioinformatics Wiki      http://wikiomics.org


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

end of thread, other threads:[~2005-11-18 18:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-18 12:50 [Caml-list] ocamlmktop mystery EL CHAAR Rabih   SGAM/AI/SAM
2005-11-18 13:35 ` Florian Weimer
2005-11-18 18:25   ` Martin Jambon

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