I want to make the platform driver I’m writing reentrant: where do I store memory dynamically assigned during the probe and/or open calls (int probe(struct platform_device*)/int open(struct inode *inode, struct file *)) The driver can be instantiated on multiple pieces of in-system hardware, with each o…
Tag: c++
scons still failed after setup env
I am using scons 1.2 on Centos 5, with devtoolset-1.1, devtoolset-1.1 root path locate at /opt/centoss/devtoolset-1.1/. I added devtoolset binary path to PATH variable, this is what I have everything look good, then I try to make a simple C program using scons I follow the guide at http://www.scons.org/doc/1.…
What is a .so.2 file?
I compiled Intel TBB from source using GCC. It generates a libtbb.so and littbb.so.2. Looks like the .so.2 file is the real shared library, libtbb.so just contains a line of text INPUT (libtbb.so.2) What is the purpose to generate these two files instead of one? For the INPUT (libtbb.so.2), what is the syntax…
Does Clang/GCC really support a delay loading feature?
Would you mind to leave your comment on this if you have really experienced which relates to the title above? I have tried to make a shared object to be delay loaded with both Clang and GCC on Ubuntu (I actually don’t mind which compiler is used), but they do not look really support any delay loading fe…
Using CLOCK_PROCESS_CPUTIME_ID in clock_gettime
I read http://linux.die.net/man/3/clock_gettime and http://www.guyrutenberg.com/2007/09/22/profiling-code-using-clock_gettime/comment-page-1/#comment-681578 It said to use this to measure how long it take for a function to run. I tried that in my program. When I run it, it returns saying it took 15 sec. But w…
Cross compiling for Linux on Windows (linker output file won’t run as executable on linux and has undefined symbols)
I’m trying to set up a cross compile for linux ELF files on Windows using clang and a version of ld which has been compiled to have elf64 support. The clang compile part is fine, it outputs ELF obj files that work when linked on linux. My test case cpp is just main containing a printf statement. To atte…
Invalid conversion from ‘FILE* {aka _IO_FILE*}’ to ‘int’
When trying to compile this little example… …I get a compiler error regarding the call to lseek(). The output is: For the record: I have also tried using both lseek(*foo, 5, SEEK_CUR); and lseek(&foo, 5, SEEK_CUR);, but that only makes things worse. (I really didn’t expect that to solve …
arm-linux-gnu-gcc fatal error: stdio.h: No such file or directory
These are the files in /usr/bin I am following this tutorial to cross compile a simple C program: Now I save this is a .c file and try to compile it; This is hapening only when I am using arm-linux-gnu-gcc. But when I am using gcc, it works fine. Why is arm-linux* giving this error? Update Verbose Host config…
Copying compiled binaries to another machine using Flash Drive
This may be a stupid question, but if I compile a shared library using g++ on one distribution of Linux, and then move those libraries as object files via flash drive to another computer with the exact same Linux distro and version of g++ will I still be able to link those libraries in my source files on the …
Alternate program for ‘less’ linux command/Making ‘less’ Secure
I want to write an interactive program like ‘less’ command for Linux. Reason I can’t use less in my setup because you can execute shell commands within less prompt ‘!cmd’ which can be a major security risk for any production box. My preferred language is C, however, if anyone can…