blob: b98876749a0eda339a71bf72b204841bf55cb602 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
/*=========================================================================
Program: KWSys - Kitware System Library
Module: $RCSfile$
Copyright (c) Kitware, Inc., Insight Consortium. All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "kwsysPrivate.h"
#include KWSYS_HEADER(DynamicLoader.hxx)
#include KWSYS_HEADER(ios/iostream)
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
#if 0
# include "DynamicLoader.hxx.in"
# include "kwsys_ios_iostream.h.in"
#endif
int TestDynamicLoader(const char* libname, const char* symbol)
{
kwsys::LibHandle l = kwsys::DynamicLoader::OpenLibrary(libname);
if( l )
{
kwsys_ios::cerr
<< kwsys::DynamicLoader::LastError() << kwsys_ios::endl;
return 1;
}
kwsys::DynamicLoaderFunction f =
kwsys::DynamicLoader::GetSymbolAddress(l, symbol);
if( f )
{
kwsys_ios::cerr
<< kwsys::DynamicLoader::LastError() << kwsys_ios::endl;
return 1;
}
int success = kwsys::DynamicLoader::CloseLibrary(l);
if( success )
{
kwsys_ios::cerr
<< kwsys::DynamicLoader::LastError() << kwsys_ios::endl;
return 1;
}
return 0;
}
int main(int , char *[])
{
int res = TestDynamicLoader("foobar.lib", "foobar");
return res;
}
|