constructor and destructore attributes
This commit is contained in:
commit
41181c3d04
16
construct_destruct.c
Normal file
16
construct_destruct.c
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#include<stdio.h>
|
||||||
|
|
||||||
|
void __attribute__((constructor)) calledFirst();
|
||||||
|
void __attribute__((destructor)) calledLast();
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
printf("\nI am in main");
|
||||||
|
}
|
||||||
|
|
||||||
|
void calledFirst() {
|
||||||
|
printf("\nI am called first");
|
||||||
|
}
|
||||||
|
|
||||||
|
void calledLast() {
|
||||||
|
printf("\nI am called last\n");
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user