Last change
on this file since 483 was 483, checked in by bird, 22 years ago |
more weaks.
|
-
Property cvs2svn:cvs-rev
set to
1.4
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
648 bytes
|
Line | |
---|
1 | /* Example on weak aliasing as found in some GCC manual:
|
---|
2 | * http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
|
---|
3 | */
|
---|
4 |
|
---|
5 | /* GCC Style */
|
---|
6 |
|
---|
7 | int __f ()
|
---|
8 | {
|
---|
9 | return 1;
|
---|
10 | }
|
---|
11 |
|
---|
12 | int f () __attribute__ ((weak, alias ("__f")));
|
---|
13 |
|
---|
14 |
|
---|
15 | /* SUN style */
|
---|
16 |
|
---|
17 | extern int WeakExternalWithLocalDefault();
|
---|
18 | #pragma weak WeakExternalWithLocalDefault = LocalDefault
|
---|
19 | int LocalDefault()
|
---|
20 | {
|
---|
21 | return -1;
|
---|
22 | }
|
---|
23 |
|
---|
24 |
|
---|
25 | #pragma weak WeakExternalWithExternalDefault = ExternalDefault
|
---|
26 | extern int ExternalDefault();
|
---|
27 | extern int WeakExternalWithLocalDefault();
|
---|
28 |
|
---|
29 |
|
---|
30 |
|
---|
31 | int main()
|
---|
32 | {
|
---|
33 | int rc;
|
---|
34 |
|
---|
35 | rc = WeakExternalWithLocalDefault();
|
---|
36 | rc += WeakExternalWithExternalDefault();
|
---|
37 |
|
---|
38 | return rc;
|
---|
39 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.