I have created a c++ app that needs to connect to a modem via a serial port in order to give AT commands. I’ve followed the following answer: how to open, read, and write from serial port in C and it works great. In some point of the code it is mentioned that the working thread should sleep for enough
Tag: c++
Dotnet core segmentation fault on linux
I have used AngleSharp to parse a website in a Dotnet core App It works fine in Windows but on Debian It crashed with this error : Segmantion fault the url that I had for parsing was https when I replaced it with an http url, It worked! Answer The problem caused by conflicting between two version of libssl. You
How can I get a guarantee that when a memory is freed, the OS will reclaim that memory for it’s use?
I noticed that this program: which allocates 3 memories, 3 times and each time frees different memory, frees the memory according to watch free -m, which means that the OS reclaimed the memory for every free regardless of the memory’s position inside the program’s address space. Can I somehow get a guarantee for this effect? Or is there already anything
Building OpenSSL and LibCURL from sources (Ubuntu) with undefined references
I’m trying to port a .dll project from Windows to Linux and I need to build OpenSSL and cURL STATICALLY. For this, I’ve tried to compile zlib as well but I get some errors I can’t figure out how to solve. I didn’t use sudo except for zlib’s $ sudo make install (since I installed it in default location /usr/local/).
Duplicate static variable initialization in C++
I build a shared library “libMyLibrary.so” with a class “MyClass” that contains a static variable of type “MyClass”. Then I build an executable “MyLibraryTest” that I link against “libMyLibrary.so”. The main program uses “dlopen” to load dynamically a “.so” given as an argument. While building, the library and executable are generated in a directory, say, “buildDir/bin”. Then I install the
linux dlopen : how to make loading lib manager
I have the same code compiled with different arch options (FMV does not work as the functions return sse and i can’t change “default” to something with sse) How can i make a meta-library that at load time checks the cpu capability and load the corresponding lib? (without any dlsym machinery)? Answer One way to achieve what you want is
SIGPIPE in C++ determining which TCP socket is disconnected
I’m using Linux/Ubuntu. I’ve written a pair of classes that implement a TCP server and TCP client, respectively. Part of the code is to have graceful recovery from disconnects. My only problem is with SIGPIPE. I’ve written code to capture the signal, but I’d like it to start the “attempt to reconnect” process on the class instance that hit the
how to disassebled binary with source line and file name using gcc-linaro-arm-linux-gnueabihf-objdump?
I want to get the disassebled binary files with source line and file name. I have added option -g as a compilation option,following is the setting in cmake files. And following is my objdump bash script: From the instructions, I should have a asm file with source line and file name just as https://manpages.debian.org/testing/binutils-arm-linux-gnueabihf/arm-linux-gnueabihf-objdump.1.en.html it says: –line-numbers Label the display
Using sysctl interface from kernel module
I am trying to access tcp_pacing_ss_ratio defined in tcp_input.c from a kernel module. The variable can be modified using the sysctl command in user space. It is however not exported and cannot be referenced directly from the module. What is the simplest way to access a sysctl entry from a kernel module? Answer From the sysctl(2) manpage: use of this
ld fails to find glfw3
I’m trying to build the OpenGL Super Bible 7th edition code samples on Ubuntu 16.04. First I have to run cmake, which seems to work, and then I have to run make to compile. I believe I have installed glfw3 and the Mesa OpenGL packages. When I execute cmake (after installing libglfw3 and libglfw3-dev), I get messages that OpenGL and