Be care when move a code from static library to dynamic library.
// file: main.cpp #include <iostream> using namespace std; int main() { cout << "main is running" << endl; return 0; } // g++ main.cpp y.cpp x.cpp // output: X is created Y is created main is running // g++ main.cpp -Llibx-so.1.0.1 -Lliby-so.1.0.1 // output: main is running