Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
What's the purpose of the static library?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  14 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
bill yan  
View profile  
 More options Sep 21 2008, 11:42 pm
Newsgroups: fa.caml
From: bill yan <Xue-Yang....@Sun.COM>
Date: Mon, 22 Sep 2008 03:42:03 UTC
Local: Sun, Sep 21 2008 11:42 pm
Subject: [Caml-list] What's the purpose of the static library?
Hi,

I noticed there are some static libraries(.a) installed with ocaml, for
example, /usr/lib/ocaml/bigarray.a. What's the purpose of those static
libraries? Thanks a lot.

Regards,
Bill

_______________________________________________
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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stéphane Glondu  
View profile  
 More options Sep 22 2008, 5:35 am
Newsgroups: fa.caml
From: Stéphane Glondu <st...@glondu.net>
Date: Mon, 22 Sep 2008 09:35:45 UTC
Local: Mon, Sep 22 2008 5:35 am
Subject: Re: [Caml-list] What's the purpose of the static library?
bill yan a écrit :

> I noticed there are some static libraries(.a) installed with ocaml, for
> example, /usr/lib/ocaml/bigarray.a. What's the purpose of those static
> libraries? Thanks a lot.

They contain (natively) compiled OCaml code. An OCaml library compiled
in native mode (usually) consists of a .a and a .cmxa file, the former
containing OCaml-specific information.

They are not to be confused with lib*.a files, which contain compiled C
stubs, and are needed for generating native-code executables, and
bytecode ones in -custom mode.

Cheers,

--
Stéphane

_______________________________________________
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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
bill yan  
View profile  
 More options Sep 23 2008, 5:16 am
Newsgroups: fa.caml
From: bill yan <Xue-Yang....@Sun.COM>
Date: Tue, 23 Sep 2008 09:16:00 UTC
Subject: Re: [Caml-list] What's the purpose of the static library?
Hi Stéphane,

Thanks a lot for your information. And we'd like to know more about the
OCaml library architectures, like on what situation dynamic libraries
are used, and when static libraries are used, and so on.. Really
appreciate if you could point me to a document that can help on this topic.

Regards,
Bill

Stéphane Glondu 已写入:

_______________________________________________
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

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Richard Jones  
View profile  
 More options Sep 23 2008, 6:17 am
Newsgroups: fa.caml
From: Richard Jones <r...@annexia.org>
Date: Tue, 23 Sep 2008 10:17:24 UTC
Local: Tues, Sep 23 2008 6:17 am
Subject: Re: [Caml-list] What's the purpose of the static library?

On Tue, Sep 23, 2008 at 05:09:58PM +0800, bill yan wrote:
> Thanks a lot for your information. And we'd like to know more about the
> OCaml library architectures, like on what situation dynamic libraries
> are used, and when static libraries are used, and so on.. Really
> appreciate if you could point me to a document that can help on this topic.

It's not particularly well-documented, and it changes a little in
3.11, but below is my understanding.  There are probably errors in
what follows.  If someone can correct the errors then I'll publish a
corrected document.

File: module.cmi ------------------------------

Contains the compiled interface for Module, essentially equivalent to
the contents of the *.mli file but in a compiled/binary form which the
compiler can load easily.

Created by: 'ocamlc -c module.mli', or if module.mli doesn't exist
then 'ocamlc -c module.ml' (also by 'ocamlopt -c module.ml').

Used: Whenever the toplevel or compiler uses any symbol Module.foo,
this file is consulted.

File: module.cmo ------------------------------

Contains the bytecode of the implementation of Module.

Created by: 'ocamlc -c module.ml'

Used: When linking bytecode programs, or creating bytecode libraries
(*.cma), or by the toplevel when you use #load, or by Dynlink.

File: library.cma ------------------------------

This is just a set of *.cmo files combined together.

Created by: 'ocamlc -a'

Used: Same as for module.cmo

Files: module.o and module.cmx --------------------

These two files go together.  The *.o file contains compiled native
code in the normal system object file format.  The *.cmx file contains
metainformation about the machine code in the *.o file.

Created by: 'ocamlopt -c module.ml'

Used: When linking native code programs, or creating native code
libraries.

Note(1): You normally never need to specify the *.o files by hand.  On
the command line when the compiler sees a *.cmx file, it looks for the
corresponding *.o file if it needs it.

Note(2): It is thought that the *.cmx file needs to be around even
when linking a library (*.cmxa) file in order to do cross-module
function inlining.  Both the Debian & Fedora packaging rules specify
that *.cmx files be kept around for this reason.  Whether this is
really true or not is not certain.

File: library.a and library.cmxa --------------------

These files go together.  The *.a file contains compiled native code
in the normal system archive format.  The *.cmxa file contains
metainformation.

Created by: 'ocamlopt -a'

Used: Same as for *.o/*.cmx

Note: You normally never need to specify the *.a files by hand.

File: dlllibrary.so and liblibrary.a --------------------

These files are created and used when a bytecode or native library
contains some C code.  'dllXXX.so' is created for use by the toplevel
and contains the compiled C code.  'libXXX.a' is created for use by
compiled standalone programs and also contains the same compiled C
code.

Created by: 'ocamlmklib -o library *.o *.cmo'
        or: 'ocamlmklib -o library *.o *.cmx'

Used: dlllibrary.so is dlopen(2)'d by the toplevel.
      liblibrary.a is linked in standalone programs.

Note: You normally never need to specify these files by hand.  The
*.cma/*.cmxa file contains the necessary information to find these
files if necessary.

----------------------------------------------------------------------

Rich.

--
Richard Jones
Red Hat

_______________________________________________
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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daniel Bünzli  
View profile  
 More options Sep 23 2008, 6:25 am
Newsgroups: fa.caml
From: Daniel Bünzli <daniel.buen...@erratique.ch>
Date: Tue, 23 Sep 2008 10:25:32 UTC
Local: Tues, Sep 23 2008 6:25 am
Subject: Re: [Caml-list] What's the purpose of the static library?

Le 23 sept. 08 à 11:09, bill yan a écrit :

> And we'd like to know more about the OCaml library architectures,  
> like on what situation dynamic libraries are used, and when static  
> libraries are used, and so on..

This depends on what _you_ want. The tradeoffs of dynamic vs static  
linking are mostly as in any other language.

> Really appreciate if you could point me to a document that can help  
> on this topic.

o Part III of the manual (especially ocamlc ocamlopt and interfacing  
with C). http://caml.inria.fr/pub/docs/manual-ocaml/
o Chapter 7 and 12 of the Oreilly book http://caml.inria.fr/pub/docs/oreilly-book/html/index.html

Best,

Daniel

_______________________________________________
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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alain Frisch  
View profile  
 More options Sep 23 2008, 7:42 am
Newsgroups: fa.caml
From: Alain Frisch <al...@frisch.fr>
Date: Tue, 23 Sep 2008 11:42:59 UTC
Local: Tues, Sep 23 2008 7:42 am
Subject: Re: [Caml-list] What's the purpose of the static library?

Richard Jones wrote:
> File: library.cma ------------------------------

> This is just a set of *.cmo files combined together.

> Created by: 'ocamlc -a'

> Used: Same as for module.cmo

cma files also contain extra linking directives like references to C
libraries.

> Files: module.o and module.cmx --------------------

> These two files go together.  The *.o file contains compiled native
> code in the normal system object file format.  The *.cmx file contains
> metainformation about the machine code in the *.o file.

> Created by: 'ocamlopt -c module.ml'

> Used: When linking native code programs, or creating native code
> libraries.

.. or compiling other modules.

> Note(1): You normally never need to specify the *.o files by hand.  On
> the command line when the compiler sees a *.cmx file, it looks for the
> corresponding *.o file if it needs it.

> Note(2): It is thought that the *.cmx file needs to be around even
> when linking a library (*.cmxa) file in order to do cross-module
> function inlining.  Both the Debian & Fedora packaging rules specify
> that *.cmx files be kept around for this reason.  Whether this is
> really true or not is not certain.

This is true.

cmx files are needed when they contain modules compiled with -for-pack.
Otherwise, they are optional. Hiding them to the compiler is a way to
get fewer dependencies (more separate compilation).

Note that the .o extension is actually .obj for the MSVC ports under
Windows.

> File: library.a and library.cmxa --------------------

> These files go together.  The *.a file contains compiled native code
> in the normal system archive format.  The *.cmxa file contains
> metainformation.

> Created by: 'ocamlopt -a'

> Used: Same as for *.o/*.cmx

> Note: You normally never need to specify the *.a files by hand.

(.lib for MSVC ports)

> File: dlllibrary.so and liblibrary.a --------------------

> These files are created and used when a bytecode or native library
> contains some C code.  'dllXXX.so' is created for use by the toplevel
> and contains the compiled C code.  'libXXX.a' is created for use by
> compiled standalone programs and also contains the same compiled C
> code.

> Created by: 'ocamlmklib -o library *.o *.cmo'
>         or: 'ocamlmklib -o library *.o *.cmx'

> Used: dlllibrary.so is dlopen(2)'d by the toplevel.
>       liblibrary.a is linked in standalone programs.

dlllibrary.so is also used by the bytecode interpreter, by Dynlink and
by ocamlc (to check for the availability of C primitives at compile time).

-- Alain

_______________________________________________
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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Conway  
View profile  
 More options Sep 23 2008, 8:50 am
Newsgroups: fa.caml
From: Chris Conway <ccon...@cs.nyu.edu>
Date: Tue, 23 Sep 2008 12:50:28 UTC
Local: Tues, Sep 23 2008 8:50 am
Subject: [Caml-list] Re: What's the purpose of the static library?

Richard Jones <rich <at> annexia.org> writes:

Richard,

This is a wonderful answer! It should go onto the wiki or in the FAQ.
One nitpick...

cma (and .cmxa) files should not be used for creating libraries
(as .cmo and .cmx files can (and should) be). I.e., don't like a
library into a library. Doing so will give a compiler error:
    X.cma is not a compilation unit description.

Regards,
Chris

_______________________________________________
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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stefano Zacchiroli  
View profile  
 More options Sep 24 2008, 7:26 am
Newsgroups: fa.caml
From: Stefano Zacchiroli <z...@upsilon.cc>
Date: Wed, 24 Sep 2008 11:26:04 UTC
Local: Wed, Sep 24 2008 7:26 am
Subject: Re: [Caml-list] What's the purpose of the static library?

On Tue, Sep 23, 2008 at 11:17:11AM +0100, Richard Jones wrote:
> It's not particularly well-documented, and it changes a little in
> 3.11, but below is my understanding.  There are probably errors in
> what follows.  If someone can correct the errors then I'll publish a
> corrected document.

Hi Richard,
  do you have a public place where this document (patched with the
received comments) is available?  If so please let us know (so that we
can reference if from the Debian OCaml packaging policy), if not I will
integrate it directly in the policy document, which is in fact publicly
available on the web.

Cheers.

--
Stefano Zacchiroli -*- PhD in Computer Science \ PostDoc @ Univ. Paris 7
zack@{upsilon.cc,pps.jussieu.fr,debian.org} -<>- http://upsilon.cc/zack/
I'm still an SGML person,this newfangled /\ All one has to do is hit the
XML stuff is so ... simplistic  -- Manoj \/ right keys at the right time

_______________________________________________
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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Richard Jones  
View profile  
 More options Sep 24 2008, 1:29 pm
Newsgroups: fa.caml
From: Richard Jones <r...@annexia.org>
Date: Wed, 24 Sep 2008 17:29:06 UTC
Local: Wed, Sep 24 2008 1:29 pm
Subject: Re: [Caml-list] What's the purpose of the static library?

On Wed, Sep 24, 2008 at 01:24:54PM +0200, Stefano Zacchiroli wrote:
> On Tue, Sep 23, 2008 at 11:17:11AM +0100, Richard Jones wrote:
> > It's not particularly well-documented, and it changes a little in
> > 3.11, but below is my understanding.  There are probably errors in
> > what follows.  If someone can correct the errors then I'll publish a
> > corrected document.

> Hi Richard,
>   do you have a public place where this document (patched with the
> received comments) is available?  If so please let us know (so that we
> can reference if from the Debian OCaml packaging policy), if not I will
> integrate it directly in the policy document, which is in fact publicly
> available on the web.

http://ocaml-tutorial.org/filenames

is probably the best place.  I've added a link to my posting
temporarily.

Rich.

--
Richard Jones
Red Hat

_______________________________________________
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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sylvain Le Gall  
View profile  
 More options Sep 24 2008, 4:10 pm
Newsgroups: fa.caml
From: Sylvain Le Gall <sylv...@le-gall.net>
Date: Wed, 24 Sep 2008 20:10:15 UTC
Local: Wed, Sep 24 2008 4:10 pm
Subject: [Caml-list] Re: What's the purpose of the static library?
On 23-09-2008, Richard Jones <r...@annexia.org> wrote:

Do you think *.cmx and *.o should be shipped?

Is *.cmx enough?

Regards
Sylvain Le Gall

_______________________________________________
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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
bill yan  
View profile  
 More options Sep 25 2008, 7:04 am
Newsgroups: fa.caml
From: bill yan <Xue-Yang....@Sun.COM>
Date: Thu, 25 Sep 2008 11:04:51 UTC
Local: Thurs, Sep 25 2008 7:04 am
Subject: Re: [Caml-list] What's the purpose of the static library?

Hi Richard,

Thanks a lot for your help on this topic.  Now I have a quesiton for the
following part:

File: library.a and library.cmxa --------------------

These files go together.  The *.a file contains compiled native code
in the normal system archive format.  The *.cmxa file contains
metainformation.

By my understanding, unlike  dlllibrary.so and liblibrary.a give user an
option to choose compile dynamically or staticly,  it seems for
library.a, user can only choose static method. Does that mean  "compiled
native code" can only be staticly linked to user's application?

Thanks & Best regards,
Bill

Richard Jones ???:

_______________________________________________
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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alain Frisch  
View profile  
 More options Sep 25 2008, 7:11 am
Newsgroups: fa.caml
From: Alain Frisch <al...@frisch.fr>
Date: Thu, 25 Sep 2008 11:11:32 UTC
Local: Thurs, Sep 25 2008 7:11 am
Subject: Re: [Caml-list] What's the purpose of the static library?

bill yan wrote:
> By my understanding, unlike  dlllibrary.so and liblibrary.a give user an
> option to choose compile dynamically or staticly,  it seems for
> library.a, user can only choose static method. Does that mean  "compiled
> native code" can only be staticly linked to user's application?

In OCaml 3.11, it will be possible to link native code (found in
library.a or module.o files) into .cmxs files that can be explicitly
loaded at runtime (with the same API as for bytecode Dynlink).

Alain

_______________________________________________
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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
bill yan  
View profile  
 More options Oct 7 2008, 11:27 pm
Newsgroups: fa.caml
From: bill yan <Xue-Yang....@Sun.COM>
Date: Wed, 08 Oct 2008 03:27:00 UTC
Subject: Re: [Caml-list] What's the purpose of the static library?
Thanks for the help. Another question, It seems *.cma *.cmxa *.a are all
native code libraries, why are there so many suffix? Is there any
difference between cma, cmxa and a?

Alain Frisch 已写入:

_______________________________________________
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

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
bill yan  
View profile  
 More options Oct 7 2008, 11:35 pm
Newsgroups: fa.caml
From: bill yan <Xue-Yang....@Sun.COM>
Date: Wed, 08 Oct 2008 03:35:29 UTC
Local: Tues, Oct 7 2008 11:35 pm
Subject: Re: [Caml-list] What's the purpose of the static library?
Sorry, I just noticed Richard already answered my question in previous
email. So Please ignore my previous email. Thanks.

bill yan 已写入:

_______________________________________________
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

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google