pocoproject / poco

The POCO C++ Libraries are powerful cross-platform C++ libraries for building network- and internet-based applications that run on desktop, server, mobile, IoT, and embedded systems.
https://pocoproject.org
Other
8.32k stars 2.15k forks source link

visibility=hidden cause the Poco::Parser error #3426

Closed zhangshaoju1987 closed 2 years ago

zhangshaoju1987 commented 2 years ago

mkdir cmake-build && cd cmake-build && cmake .. -DCMAKE_CXX_FLAGS="-fvisibility=hidden" When I build my application with "-fvisibility=hidden" , I running my app and I got the error below: [2021-10-11 10:34:15] RemoteMessageReceiver [Error] Parse error:Can not convert N4Poco9SharedPtrINS_4JSON6ObjectENS_16ReferenceCounterENS_13ReleasePolicyIS2_EEEE to N4Poco9SharedPtrINS_4JSON6ObjectENS_16ReferenceCounterENS_13ReleasePolicyIS2_EEEE. message is:{"notification":true,"method":"roomReady","data":{"turnServers":null}}

But when I build my app with visibility=default , all is working well.

below is my code: `if (this->channel->available() == 0 && this->channel->poll(Timespan(pollTimeout), Socket::SELECT_READ) == false) { // continue; } Poco::Buffer buffer(0); n = this->channel->receiveFrame(buffer, flags); // std::string res(buffer.begin(), n); if (n > 0) { this->logger->debug("Message from server side:" + res + " ;size=" + std::tostring(n)); Parser parser; Var result = nullptr; try { result = parser.parse(res);_ // this line throw error Object::Ptr message = result.extract(); RemoteMessage* rMessage = new RemoteMessage(message); if (rMessage->isResponse()) { this->responseNotificationCenter->postNotification(rMessage); } else { this->messageQueue->enqueueNotification(rMessage); } } catch (Poco::Exception& exception) { this->logger->error("Parse error:" + exception.message() + " message is:" + res); //closed by protoo-server break; }

                continue;
            }`
zhangshaoju1987 commented 2 years ago

Should I compile Poco with visibility=hidden too?

zhangshaoju1987 commented 2 years ago

I build my app on mac os x86_64, 10.15