使用phpx写了一个简单的容器,想放到php中运行做点测试。我在这之前已经成功的写了一个dispatch_function注册到了swoole中,而且运行正常。
后面我又写了个C++类,新建了个PHP类,并将C++类的各个方法注册到了PHP类中。编译通过了,但是PHP加载这个扩展却失败了,报错
PHP Warning: PHP Startup: Unable to load dynamic library '/mypath/mango.so' (tried: /mypath/mango.so (/mypath/mango.so: undefined symbol: _ZN7Context4poolE)...
C++源代码如下
#include
#include
#include
#include "../include/phpx.h"
#include
#include
using namespace std;
using namespace php;
int dispatch_function(swServer *serv, swConnection *conn, swEventData *data);
class Context {
private:
static unordered_map pool;
public:
void static get(Object &_this, Args &args, Variant &retval) {
int key = args[0].toInt();
char * value &#