The “shell” built-in function supported by GNU Make can be used to get the list of C source files in a directory. Then a list of corresponding object files can be created by replacing the file extension in the file list. Read Full Article.
Archive for the 'C' Category
GNU Make – How to compile all c files in present directory
February 26, 2009Find peer IP address and port number using getpeername
July 12, 2008The getpeername function can be used to retrieve the peer IP address and port number on a given socket. For this to work, the socket should have a valid TCP connection established. Typically this is used by server to find the IP address and port number of client. Read more in “Find peer IP address [...]
Find local IP address and local port number using getsockname
July 12, 2008The getsockname function can be used to find the local port used by a given socket. It is valid to use this function only if the socket is already using a local port number. i.e A server socket which invoked bind system call with zero as port number. A client socket which has established connection [...]
Resolve “Address already in use” error with socket bind
July 12, 2008To get rid of Address already in use” error with bind system call, SO_REUSEADDR socket option should be set before invoking bind. This makes operating system to allow the socket to bind if there is no active socket bound to the requested address and port. See code example in Resolve “Address already in use” error [...]
Parse words in a string
July 10, 2008Find how a string is parsed and split in to words and returned as array of pointers each pointing to start of each word. Get the details and code snippet here.
http://www.techpulp.com/articles/c/snip-parse-words.php
Remove Unused/Dead Functions From ELF Binary
July 10, 2008You can optimize the size of ELF executable by removing unused or dead functions. There are two options “-ffunction-sections -Wl,–gc-sections” to do that.
Find more details in my article here:
http://www.techpulp.com/articles/c/tip-elf-strip-unused-functions.php
ELF Binary Size Optimization
July 10, 2008You can use some optimization flags, linker flags and ‘strip‘ tool to reduce the size of target ELF binary.
For more details read my article here:
http://www.techpulp.com/articles/c/art-elf-size-optimization.php
Examine Stack Frame of a Running Process
July 10, 2008You can use ‘pstack‘ command view the stack frame of a running process.
For more details read this:
http://www.techpulp.com/articles/c/tip-stack-of-running-process.php