Find DLL/SO of an Executable

On Linux


ldd – print shared library dependencies

$ cat hello.cpp
#include <iostream>
int main()
        std::cout << "Hello, world!" << std::endl;         return 0;
$ g++ -o hello hello.cpp $ ldd -v hello =>  (0x00007fffb0bfd000) => /usr/lib64/ (0x0000003964a00000) => /lib64/ (0x000000395e600000) => /lib64/ (0x0000003964200000) => /lib64/ (0x000000395e200000)
        /lib64/ (0x000000395de00000)

        Version information:
       (GLIBC_2.2.5) => /lib64/
       (CXXABI_1.3) => /usr/lib64/
       (GLIBCXX_3.4) => /usr/lib64/
       (GLIBC_2.3) => /lib64/
       (GCC_4.2.0) => /lib64/
       (GCC_3.3) => /lib64/
       (GCC_3.0) => /lib64/
       (GLIBC_2.3.2) => /lib64/
       (GLIBC_2.4) => /lib64/
       (GLIBC_2.3) => /lib64/
       (GLIBC_2.2.5) => /lib64/
       (GLIBC_2.2.5) => /lib64/
       (GLIBC_2.4) => /lib64/
       (GLIBC_2.2.5) => /lib64/
       (GLIBC_2.3) => /lib64/
       (GLIBC_PRIVATE) => /lib64/


locate – locate reads one or more databases prepared by updatedb(8) and writes file names matching at least one of the PATTERNs to standard output, one per line.

By default, locate does not check whether files found in database still exist; locate can never report files created after the most recent update of the relevant database.


Process Monitor

Process Monitor is an advanced monitoring tool for Windows that shows real-time file system, Registry and process/thread activity.

  • More data captured for operation input and output parameters
  • Non-destructive filters allow you to set filters without losing data
  • Capture of thread stacks for each operation make it possible in many cases to identify the root cause of an operation
  • Reliable capture of process details, including image path, command line, user and session ID
  • Configurable and moveable columns for any event property
  • Filters can be set for any data field, including fields not configured as columns
  • Advanced logging architecture scales to tens of millions of captured events and gigabytes of log data
  • Process tree tool shows relationship of all processes referenced in a trace
  • Native log format preserves all data for loading in a different Process Monitor instance
  • Process tooltip for easy viewing of process image information
  • Detail tooltip allows convenient access to formatted data that doesn’t fit in the column
  • Cancellable search
  • Boot time logging of all operations

Environment in Make

Following description is based on linux/bash. It is easy to switch to other platforms/shells.

Set Environment

There are two ways to set environment variables

export MYVAR=myvalue

the command sets the environment variable in current shell, the variable keep valid until it is deleted or changed and will be passed to all child processes by default.

MYVAR=myvalue command

This sets the environment variable for the command only (and it will be inherited by that process. It won’t change current shell environment.

We use this perl script to show a process environment

$ cat
#! /usr/bin/env perl

my $en = shift || 'MYVAR';
my $ev = $ENV{$en};
$ev = '' unless defined($ev);
print "$en=$ev\n";

Here is the result

$ ./
$ export MYVAR=hello
$ echo $MYVAR
$ ./
$ unset MYVAR
$ echo $MYVAR

$ ./
$ MYVAR=Hello ./
$ echo $MYVAR


Set Make Variable

Make variable can be set by environment (by setting before make), by command line (by setting after make), or set inside make file.

  1. both environment and command set initial variable value
  2. inside setting override environment value (unless -e is set for make)
  3. command line setting always overrides makefile setting (in other words, makefile setting can’t change command line settings)

Here is a makefile

$(info init value CC=$(CC), CXX=$(CXX))

CC :=gcc
CXX :=g++

        @echo CC=$(CC) CXX=$(CXX)

The execute result is

$ CC=hello make
init value CC=hello, CXX=g++
CC=gcc CXX=g++
$ CC=hello make -e
init value CC=hello, CXX=g++
CC=hello CXX=g++
$ make CC=hello
init value CC=hello, CXX=g++
CC=hello CXX=g++
$ CC=hello make CXX=world
init value CC=hello, CXX=world
CC=gcc CXX=world