clang claims weak aliases are not supported on Darwin. The following code doesn't compile:
#include <stdio.h>
int func1( ) { return 42; }
__attribute__((weak, alias("func1"))) int func2( );
int main( )
{
printf("%d\n", func2());
return 0;
}
Output:
test1.c:4:22: error: aliases are not supported on darwin
__attribute__((weak, alias("func1"))) int func2( );
^
1 error generated.
But that's not true. Weak aliases are supported on Darwin. The following code will compile and will behave correctly:
#include <stdio.h>
int func1( ) { return 42; }
#pragma weak func2 = func1
int func2( );
int main( )
{
printf("%d\n", func2());
return 0;
}
clang claims weak aliases are not supported on Darwin. The following code doesn't compile:
Output:
But that's not true. Weak aliases are supported on Darwin. The following code will compile and will behave correctly: