小编den*_*s90的帖子

当.so尝试使用主可执行文件中的类时,dlopen()给出未解析的符号错误.为什么?

我在Linux上,问题是关于C++类的共享对象.

当我的共享对象尝试使用链接到主可执行文件的资源时,问题就出现了.我有以下代码:

loader.cpp:

#include <dlfcn.h>
#include <iostream>
#include "CommonInfo.h"

using namespace std;

int main(int argc, char** argv) {
    for(int i=1; i<argc; ++i) {
        string pth = "./";
        pth.append(argv[i]);
        void* dh = dlopen(pth.c_str(), RTLD_NOW);
        if(dh==NULL) {
            cerr << dlerror() << endl;
            return 1;
        }

        CommonInfo::GetInfoFunc getInfo = (CommonInfo::GetInfoFunc)(dlsym(dh,"getInfo"));
        if(getInfo==NULL) {
            cerr << dlerror() << endl;
            return 1;
        }

        CommonInfo* info = getInfo();
        cout << "INFO: " << info->getX() << endl;
        delete info;
    }
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

CommonInfo.h:

#include <string>

class CommonInfo …
Run Code Online (Sandbox Code Playgroud)

c++ plugins shared-libraries

2
推荐指数
1
解决办法
2957
查看次数

Reduce TCP maximum segment size (MSS) in Linux on a socket

In a special application in which our server needs to update firmware of low-on-resource sensor/tracking devices we encountered a problem in which sometimes data is lost in the remote devices (clients) receiving packets of the new firmware. The connection is TCP/IP over GPRS network. The devices use SIM900 GSM chip as a network interface.

The problems possibly come because of the device receiving too much data. We tried reducing the traffic by sending packages more rarely but sometimes the error …

sockets linux tcp mss

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

c++ ×1

linux ×1

mss ×1

plugins ×1

shared-libraries ×1

sockets ×1

tcp ×1