23.05.2014 Views

Athena Developer Guide

Athena Developer Guide

Athena Developer Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Athena</strong> Chapter 18 Framework packages, interfaces and libraries Version/Issue: 2.0.0<br />

the component libraries, export all the symbols and are needed during the linking phase in the<br />

application building. These libraries can be linked to the application "statically" or "dynamically",<br />

requiring a different file format. In the first case the code is added physically to the executable file. In<br />

this case, changes in these libraries require the application to be re-linked, even if these changes do not<br />

affect the interfaces. In the second case, the linker only adds into the executable minimal information<br />

required for loading the library and resolving the symbols at run time. Locating and loading the proper<br />

shareable library at run time is done exclusively using the LD_LIBRARY_PATH for Linux and PATH<br />

for Windows. The convention in Gaudi is that linker libraries have the same name as the package,<br />

suffixed by "Lib" (and prefixed by "lib" on Linux, e.g. libMyComponentsLib.so).<br />

18.4.3 Library strategy and dual purpose libraries<br />

Because component libraries are not designed to be linked against, it is important to separate the<br />

functionalities of these libraries from linker libraries. For example, consider the case of a DataProvider<br />

service that provides DataObjects for clients. It is important that the declarations and definitions of the<br />

DataObjects be handled by a different shared library than that handling the service itself. This implies<br />

the presence of two different packages - one for the component library, the other for the DataObjects.<br />

Clients should only depend on the second of these packages. Obviously the package handling the<br />

component library will in general also depend on the second package.<br />

It is possible to have dual purpose libraries - ones which are simultaneously component and linker<br />

libraries. In general such libraries will contain DataObjects and ContainedObjects, together with their<br />

converters and associated factories. It is recommended that such dual purpose libraries be separated<br />

from single purpose component or linker libraries. Consider the case where several Algorithms share<br />

the use of several DataObjects (e.g. where one Algorithm creates them and registers them with the<br />

transient event store, and another Algorithm locates them), and also share the use of some helper<br />

classes in order to decode and manipulate the contents of the DataObjects. It is recommended that three<br />

different packages be used for this - one pure component package for the Algorithms, one dual-purpose<br />

for the DataObjects, and one pure linker package for the helper classes.<br />

18.4.4 Building and linking with the libraries<br />

Gaudi libraries and applications are built using CMT, but may be used also by experiments using other<br />

configuration management tools, such as ATLAS SRT.<br />

18.4.4.1 Building and linking to the Gaudi libraries with CMT<br />

page 166<br />

Gaudi libraries and applications are built using CMT taking advantage of the CMT macros defined in<br />

the GaudiPolicy package. As an example, the CMT requirements file of the GaudiTools<br />

package is shown in Listing 18.7. The linker and component libraries are defined on lines 23 and 26<br />

respectively - the linker library is defined first because it must be built ahead of the component library.<br />

Lines 28 and 34 set up the generic linker options and flags for the linker library, which are suffixed by<br />

the package specific flags set up by line 35. Line 31 tells CMT to generate the symbols needed for the

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!