-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwinxedxx_nci.cxx
More file actions
86 lines (70 loc) · 1.64 KB
/
winxedxx_nci.cxx
File metadata and controls
86 lines (70 loc) · 1.64 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// winxedxx_nci.cxx
// (C) 2012 Julián Albo
#include "winxedxx.h"
#include "winxedxx_ptr.h"
#include <dlfcn.h>
namespace WinxedXX
{
//*************************************************************
WxxNCI::WxxNCI(const std::string &funcname) :
WxxDefault("NCI"),
name(funcname)
{
}
int WxxNCI::get_integer()
{
return get_pointer() != 0;
}
void * WxxNCI::get_pointer()
{
return getNciFun();
}
WxxObjectPtr WxxNCI::operator()(WxxObjectArray &args)
{
return winxedxxnull;
}
//*************************************************************
WxxObjectPtr handleResult(int value)
{
return new WxxInteger(value);
}
WxxObjectPtr handleResult(short value)
{
return new WxxInteger(value);
}
WxxObjectPtr handleResult(long value)
{
return new WxxInteger(value);
}
WxxObjectPtr handleResult(double value)
{
return new WxxFloat(value);
}
WxxObjectPtr handleResult(float value)
{
return new WxxFloat(value);
}
WxxObjectPtr handleResult(void * value)
{
return new WxxPtr(value);
}
//*************************************************************
WxxObjectPtr wxx_loadlib(const std::string &libname)
{
void *dl_handle = dlopen(libname.c_str(), RTLD_LAZY);
if (dl_handle == NULL)
return WxxObjectPtr(0); // Sort of Undef for a now
else
return WxxObjectPtr(new WxxLibrary(dl_handle));
}
void * wxx_ncigetfunc(WxxObjectPtr lib, const std::string &funcname)
{
void *fun = 0;
if (lib.is_null())
fun = dlsym(0, funcname.c_str());
else if (WxxLibrary *dlib = lib.getlib())
fun = dlib->getsym(funcname.c_str());
return fun;
}
} // namespace WinxedXX
// End of winxedxx_nci.cxx