| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Libtool was first implemented in order to add support for writing shared libraries in the C language. However, over time, libtool is being integrated with other languages, so that programmers are free to reap the benefits of shared libraries in their favorite programming language.
This chapter describes how libtool interacts with other languages, and what special considerations you need to make if you do not use C.
| 6.1 Writing libraries for C++ | ||
| 6.2 Tags |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Creating libraries of C++ code should be a fairly straightforward process, because its object files differ from C ones in only three ways:
ld directly to link such libraries, and
we should use the C++ compiler instead.
ld to link a C++ program or library is deemed
to fail.
Because of these three issues, Libtool has been designed to always use
the C++ compiler to compile and link C++ programs and libraries. In
some instances the main() function of a program must also be
compiled with the C++ compiler for static C++ objects to be properly
initialized.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Libtool supports multiple languages through the use of tags. Technically
a tag corresponds to a set of configuration variables associated with a
language. These variables tell libtool how it should create
objects and libraries for each language.
Tags are defined at configure-time for each language activated
in the package (see LT_LANG in The LT_INIT macro). Here is the
correspondence between language names and tags names.
Language name | Tag name |
C | CC |
C++ | CXX |
Java | GCJ |
Fortran 77 | F77 |
Fortran | FC |
Windows Resource | RC |
libtool tries to automatically infer which tag to use from
the compiler command being used to compile or link. If it can't infer
a tag, then it defaults to the configuration for the C language.
The tag can also be specified using libtool's
`--tag=tag' option (see section Invoking libtool). It is a good
idea to do so in `Makefile' rules, because that will allow users to
substitute the compiler without relying on libtool inference
heuristics. When no tag is specified, libtool will default
to CC; this tag always exists.
Finally, the set of tags available in a particular project can be
retrieved by tracing for the LT_SUPPORTED_TAG macro (see section Libtool's trace interface).
| [ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on July, 20 2009 using texi2html 1.76.