2013-02-12 07:03:35 +08:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2013-03-01 09:09:46 +08:00
|
|
|
extern int i;
|
|
|
|
int i = 42;
|
|
|
|
|
2013-04-25 03:00:26 +08:00
|
|
|
// Undefined weak function in a dynamic library.
|
|
|
|
__attribute__((weak)) void weakfoo();
|
|
|
|
|
|
|
|
// Regular funtion in a dynamic library.
|
2013-02-12 07:03:35 +08:00
|
|
|
void foo() {
|
2013-04-25 03:00:26 +08:00
|
|
|
// Try to call weakfoo so that the reference to weekfoo will be included in
|
|
|
|
// the resulting .so file.
|
|
|
|
if (weakfoo)
|
|
|
|
weakfoo();
|
2013-02-12 07:03:35 +08:00
|
|
|
puts("Fooo!!");
|
|
|
|
}
|