1
/*=========================================================================
3
Program: CMake - Cross-Platform Makefile Generator
4
Module: $RCSfile: cmDynamicLoader.h,v $
6
Date: $Date: 2002/10/23 22:03:26 $
7
Version: $Revision: 1.5 $
9
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12
This software is distributed WITHOUT ANY WARRANTY; without even
13
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14
PURPOSE. See the above copyright notices for more information.
16
=========================================================================*/
17
// .NAME cmDynamicLoader - class interface to system dynamic libraries
18
// .SECTION Description
19
// cmDynamicLoader provides a portable interface to loading dynamic
20
// libraries into a process.
23
#ifndef __cmDynamicLoader_h
24
#define __cmDynamicLoader_h
26
#include "cmStandardIncludes.h"
28
// Ugly stuff for library handles
29
// They are different on several different OS's
32
typedef shl_t cmLibHandle;
35
typedef HMODULE cmLibHandle;
37
typedef void* cmLibHandle;
40
// Return type from cmDynamicLoader::GetSymbolAddress.
41
typedef void (*cmDynamicLoaderFunction)();
47
// Load a dynamic library into the current process.
48
// The returned cmLibHandle can be used to access the symbols in the
50
static cmLibHandle OpenLibrary(const char*);
53
// Attempt to detach a dynamic library from the
54
// process. A value of true is returned if it is successful.
55
static int CloseLibrary(cmLibHandle);
58
// Find the address of the symbol in the given library
59
static cmDynamicLoaderFunction GetSymbolAddress(cmLibHandle, const char*);
62
// Return the library prefix for the given architecture
63
static const char* LibPrefix();
66
// Return the library extension for the given architecture
67
static const char* LibExtension();
70
// Return the last error produced from a calls made on this class.
71
static const char* LastError();
74
// Flush the cache of dynamic loader.
75
static void FlushCache();
79
~cmDynamicLoader() {};
83
cmDynamicLoader(const cmDynamicLoader&); // Not implemented.
84
void operator=(const cmDynamicLoader&); // Not implemented.