* provided "as is" without express or implied warranty. *
**************************************************************************/
-/** @file AliHLTComponentHandler.cxx
- @author Matthias Richter, Timm Steinbeck
- @date
- @brief Implementation of HLT component handler. */
+/// @file AliHLTComponentHandler.cxx
+/// @author Matthias Richter, Timm Steinbeck
+/// @date
+/// @brief Implementation of HLT component handler.
+///
// see header file for class documentation
// or
AddStandardComponents();
}
+/*
+2010-09-06 TODO: This is a workaround for unresolved library dependencies
+with the aliroot build system. Some of the component libraries might need
+libraries not linked to the aliroot executable. I also tried to link component
+libraries to their dependencies in aliroot, but there is some awkward dependency
+and even a flaw in the build system leaving the library not built if the
+dependency was not found.
+Ideally we decouple library and component handler. The library handler needs to
+manage all dependencies, the unload-problem, etc.
+This issue is releated to https://savannah.cern.ch/task/?16325
+*/
+const std::pair<const char*, const char*> AliHLTComponentHandler::fgkLibDep[] = {
+ make_pair("libAliHLTUtil.so", "libANALYSIS.so"),
+ make_pair("libAliHLTUtil.so", "libANALYSISalice.so")
+};
+
AliHLTComponentHandler::~AliHLTComponentHandler()
{
// see header file for class documentation
hLib.fHandle=pRootHandle;
}
- if (hLib.fHandle==NULL && gSystem->Load(libraryPath)>=0) {
+ if (hLib.fHandle==NULL &&
+ LoadDependencies(libraryPath) >=0 &&
+ gSystem->Load(libraryPath)>=0) {
int* pRootHandle=new int;
if (pRootHandle) *pRootHandle=1;
hLib.fHandle=pRootHandle;
return iResult;
}
+int AliHLTComponentHandler::LoadDependencies( const char* libraryPath)
+{
+ // Load external library dependencies defined in a static array
+ if (!libraryPath) return -EINVAL;
+
+#ifndef HAVE_DLFCN_H
+ for (unsigned i=0; i<sizeof(fgkLibDep)/sizeof(fgkLibDep[0]); i++) {
+ if (strcmp(libraryPath, (fgkLibDep[i]).first)==0) {
+ HLTInfo("loading library dependency for %s: %s", libraryPath, (fgkLibDep[i]).second);
+ int result=gSystem->Load((fgkLibDep[i]).second);
+ if (result<0) {
+ HLTError("failed to load library dependency for %s: %s", libraryPath, (fgkLibDep[i]).second);
+ return result;
+ }
+ }
+ }
+#else
+ static bool bWarning=true;
+ if (bWarning) {
+ bWarning=false;
+ HLTWarning("function not supposed to be used with dlopen, all library dependencies need to be compiled in");
+ }
+#endif // !HAVE_DLFCN_H
+
+ return 0;
+}
+
int AliHLTComponentHandler::UnloadLibrary( const char* libraryPath )
{
// see header file for class documentation
//-*- Mode: C++ -*-
-// @(#) $Id$
+// $Id$
#ifndef ALIHLTCOMPONENTHANDLER_H
#define ALIHLTCOMPONENTHANDLER_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
+//* This file is property of and copyright by the ALICE HLT Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* See cxx source for full Copyright notice *
-/** @file AliHLTComponentHandler.h
- @author Matthias Richter, Timm Steinbeck
- @date
- @brief Global handling of HLT processing components
- @note The handler is part of the interface and both used in the
- Online (PubSub) and Offline (AliRoot) context.
- */
+/// @file AliHLTComponentHandler.h
+/// @author Matthias Richter, Timm Steinbeck
+/// @date
+/// @brief Global handling of HLT processing components
+/// @note The handler is part of the interface and both used in the
+/// Online (PubSub) and Offline (AliRoot) context.
// see below for class documentation
// or
// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
#include <vector>
+#include <utility>
//#include "TObject.h"
#include "AliHLTDataTypes.h"
#include "AliHLTLogging.h"
*/
int LoadLibrary( const char* libraryPath, int bActivateAgents=1);
+ /**
+ * Load external library dependencies defined in a static array.
+ */
+ int LoadDependencies( const char* libraryPath);
+
/**
* Find a symbol in a dynamically loaded library.
* @param library library
/** the global singleton */
static AliHLTComponentHandler* fgpInstance; //!transient
/** number of used instances of the global singleton */
- static int fgNofInstances; //!transient
+ static int fgNofInstances; //!transient
+ /// library dependencies
+ static const std::pair<const char*, const char*> fgkLibDep[]; //!transient
ClassDef(AliHLTComponentHandler, 2);