-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathlib.cpp
More file actions
52 lines (37 loc) · 1.04 KB
/
Copy pathlib.cpp
File metadata and controls
52 lines (37 loc) · 1.04 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
#include <string>
#include <vector>
#ifdef _WIN32
#define LIB_EXPORT __declspec(dllexport)
#else
#define LIB_EXPORT
#endif
// C functions and variables
extern "C" {
LIB_EXPORT double pi_value = 3.14159;
LIB_EXPORT const char *hello_world() {
return "Hello World!";
}
}
// C++ functions and global variables
namespace example {
LIB_EXPORT unsigned int magic = 0xcafebabe;
namespace dylib {
LIB_EXPORT std::string info() {
return "dylib - v3.1.0";
}
}
LIB_EXPORT double adder(double a, double b) {
return a + b;
}
LIB_EXPORT std::string adder(const std::string &a, const std::string &b) {
return a + b;
}
LIB_EXPORT std::vector<std::string> adder(const std::vector<std::string> &a, const std::vector<std::string> &b) {
std::vector<std::string> result = a;
result.insert(result.end(), b.begin(), b.end());
return result;
}
LIB_EXPORT double operation(double a, double b, double (*cb)(double, double)) {
return cb(a, b);
}
}