ALBA
albaDynamicLoader.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaDynamicLoader
5 Authors: Based on DynamicLoader (www.itk.org), adapted by Marco Petrone
6
7 Copyright (c) BIC
8 All rights reserved. See Copyright.txt or
9
10
11 This software is distributed WITHOUT ANY WARRANTY; without even
12 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE. See the above copyright notice for more information.
14
15=========================================================================*/
16#ifndef __albaDynamicLoader_h
17#define __albaDynamicLoader_h
18#include "albaBase.h"
19#include "albaConfigure.h"
20
21// Ugly stuff for library handles.
22// They are different on several different OS's
23#if defined(__hpux)
24
25# include <dl.h>
26typedef shl_t LibHandle;
27
28#elif defined(_WIN32)
29
30#include "albaIncludeWIN32.h"
31typedef HINSTANCE LibHandle;
32
33#elif defined(__powerpc)
34
35typedef ConnectionID LibHandle;
36
37#else
38
39typedef void* LibHandle;
40
41#endif
42
51class ALBA_EXPORT albaDynamicLoader : public albaBase
52{
53public:
57 static LibHandle OpenLibrary(const char*);
58
62
64 static void* GetSymbolAddress(LibHandle, const char*);
65
67 static const char* LibPrefix();
68
70 static const char* LibExtension();
71
73 static const char* LastError();
74
75protected:
78};
79
80#endif
81
void * LibHandle
albaBase - the pourpose of this class is just to groups utilities classes
Definition: albaBase.h:27
Portable loading of dynamic libraries or dll's.
static int CloseLibrary(LibHandle)
Attempt to detach a dynamic library from the process.
static void * GetSymbolAddress(LibHandle, const char *)
Find the address of the symbol in the given library.
static const char * LibPrefix()
Return the library prefix for the given architecture.
static LibHandle OpenLibrary(const char *)
Load a dynamic library into the current process.
static const char * LastError()
Return the last error produced from a calls made on this class.
static const char * LibExtension()
Return the library extension for the given architecture.