I would like to write and read data from the DataLayer and also provide a user interface through the browser for configuration of the app.
I'm using the following HTTP Library: https://github.com/yhirose/cpp-httplib
Now I face the following problem: When creating a datalayer node and including the httplib.h file, the snap app crashes.
The minimal example I could recreate, was to use the datalayer.register.node sample and just put a
at the top of the main.cpp file (and also put the httplib.h file next to the main.cpp). Building the sample works, but when the app starts it crashes (seg faults) directly.
I did not put any additional code, only the include. All classes and methods are behind namespaces. I also tried to rename all defines to be unique, but the crash did not change. The crash occurs during the start() of the provider.
Using the split.py script from the github project, I could split the httplib.h file into a httplib.cc and httplib.h, than I created a shared libary. Now when I build the project and link against the shared library (and also starting a http server serving a simple site), the app crashes when an access over http occurs. With this setup I also saw the message, that the segfault occured in the libcomm_datalayer.so:
appname: segfault at 15 ip 00007f5d16e98184 sp 00007f5d06ffbee0 error 4 in libcomm_datalayer.so[7f5d16d97000+25f000]
Including the new httplib.h file (after splitting it with split.py) worked fine, so the includes and defines from httplib.h are not the culprit.
Do I need to configure the sockets from the httplib library in some specific way to not to conflict with the datalayer sockets?
I tried to reproduce your errors but could not in my case (withyour minimal example) everthing works just fine. See my snaps attached.
Which version of the system (please make a system report via "About -> Generate Report") and the SDK are you using?
Thank you very much!
From your snap I saw that you are using the IPC connection (DL_IPC_AUTO) instead of "tcp://...". With DL_IPC_AUTO everything seems to work fine. But with "tcp://..." the above crashes occure.
Thus I will be using DL_IPC_AUTO.
I'm using the SDK Version 1.8.0 RM21.07 and CtrlX Works 1.8.1. Do you still need the system report?