Interpositioning

An interesting "issue", when more than one external name can be taken part in the linking. Also be care with the left-to-write searching method of linkers.


// a.cpp

#include <iostream>

using namespace std;

extern int g();
extern int f();

int main()
{
    cout << f( ) << endl;
    return 0;
}

int g()
{
    return 2;
}

////////////////////////////////


// b.cpp

int g()
{
    return 1;
}
int f()
{
    return g();
}