From 41181c3d04fb3e753e902e389f708b17f370b3d4 Mon Sep 17 00:00:00 2001 From: Richard Thier Date: Thu, 24 Apr 2025 18:19:47 +0200 Subject: [PATCH] constructor and destructore attributes --- construct_destruct.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 construct_destruct.c diff --git a/construct_destruct.c b/construct_destruct.c new file mode 100644 index 0000000..6914a2c --- /dev/null +++ b/construct_destruct.c @@ -0,0 +1,16 @@ +#include + +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"); +}