blob: 6ad3552f2bc5e5075c2e9173b7e7eba86da89a7f (
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
|
#include <phpcpp.h>
#include "master.h"
#include "child.h"
/**
* tell the compiler that the get_module is a pure C function
*/
extern "C" {
/**
* Function that is called by PHP right after the PHP process
* has started, and that returns an address of an internal PHP
* strucure with all the details and features of your extension
*
* @return void* a pointer to an address that is understood by PHP
*/
PHPCPP_EXPORT void *get_module()
{
// static(!) Php::Extension object that should stay in memory
// for the entire duration of the process (that's why it's static)
static Php::Extension extension("returnobjecy", "1.0");
// we have to class - master and child
Php::Class<Master> master("master");
Php::Class<Child> child("child");
// the master class has one method - to return a child
master.method("child", &Master::child);
// add all classes to the extension
extension.add(master);
extension.add(child);
// return the extension
return extension;
}
}
|