blob: b0259cae5cd19879a45ecc8156fb7a7da395a594 (
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
|
/**
* Simple.h
*
* A very simple extension that does almost nothing
*
* @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
* @copyright 2013 Copernica BV
*/
#include <string>
#include <iostream>
#include <phpcpp.h>
/**
* Namespace to use
*/
using namespace std;
static int my_plus(int a, int b)
{
return a + b;
}
static std::string my_concat(std::string &a, std::string &b)
{
return a + b;
}
Function f({"my_plus", my_plus});
// symbols are exported according to the "C" language
extern "C"
{
// export the "get_module" function that will be called by the Zend engine
PHPCPP_EXPORT void *get_module()
{
// create extension
static PhpCpp::Extension extension("simple","1.0", {
{"my_plus", my_plus},
{"my_concat", my_concat}
});
// return the module entry
return extension.getEntry();
}
}
|