I’m trying to create a hello world project for Linux dynamic libraries (.so files). So I have a file hello.c: How do I create a .so file that exports hello(), using gcc from the command line? Answer To generate a shared library you need first to compile your C code with the -fPIC (position independent code) flag. This will generate
Tag: c++
How to design GUIs on Linux and C++ [closed]
It’s difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago. I am new to Linux. I would like to be able to program
Allocate more than 2GB on the heap using c++ on a 32bit linux kernel
This seems to be a very common problem, but still I haven’t found a definite answer. I have access to a server which runs linux, has 16 GB of RAM and a 16-core (64bit) CPU (/proc/cpuinfo gives “Intel(R) Xeon(R) CPU E5520 @ 2.27GHz”). However, the kernel is 32bit (uname -m gives i686). Of course, I have no root access, so
Generate LLVM C++ API code as backend
The Online LLVM demo page had an option to generate LLVM C++ API code as backend from a source code. However, that demo page is now disabled. I was wondering how we can do it ourselves using the available LLVM tools. I tried the following which gives the following error I am using LLVM/Clang version 3.2. Answer The LLVM C++
Buildroot : Which gcc for cross compilation?
I am newbee to buildroot. I can see multiple gccs in buildroot. I assume all are for cross compilation. What are the difference between those ? Answer The one you should use is buildroot-2012.05/output/host/usr/bin/arm-unknown-linux-uclibcgnueabi-gcc. The other ones are purely internals binaries.
ALSA: Ways to prevent underrun for speaker
I am playing a single channel audio in non-interleaved mode. I am getting underrun when I am writing audio data into speaker : ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred Here is how I write: What are the different ways/parameter configurations to prevent ALSA under run ? (I am using Linux 3.0, ARM ) Edit: Here is a buffer measurement using snd_pcm_avail()
Delete a Linux signal handler in C
I use: To add handler of SIGINT event. But how can i delete this handler? Answer Here is what you do: That resets the signal handler back to whatever the default behavior was for that signal (including the default disposition if it hasn’t been set). In the case of SIGINT, it’s aborting your process without a core dump. The manual
how to verify tcp checksum [closed]
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 10 years ago. For some odd reason,
Troubles with using memcpy with mmap
Trying to copy a file using these functions, everything goes fine until program hits the memcpy function which gives a bus error and terminates the process. Failed to figure out what is wrong, as “Bus Error” isn’t a descriptive error message and there isn’t any much material on the internet regarding this problem. Answer When you create the destination file
Fastest technique to pass messages between processes on Linux?
What is the fastest technology to send messages between C++ application processes, on Linux? I am vaguely aware that the following techniques are on the table: TCP UDP Sockets Pipes Named pipes Memory-mapped files are there any more ways and what is the fastest? Answer I would suggest looking at this also: How to use shared memory with Linux in