From b8e0ca76b145606bb2f0747f1e603cb62a04fa41 Mon Sep 17 00:00:00 2001 From: Brendan Le Foll Date: Tue, 13 May 2014 20:44:34 +0000 Subject: [PATCH] maa_init: add GCC attribute to call init function as a constructor Signed-off-by: Brendan Le Foll --- src/maa.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/maa.c b/src/maa.c index 631724e..b02061c 100644 --- a/src/maa.c +++ b/src/maa.c @@ -40,6 +40,12 @@ maa_get_version() return gVERSION; } +#ifndef SWIG +// this sets a compiler attribute (supported by GCC & clang) to have maa_init() +// be called as a constructor make sure your libc supports this! uclibc needs +// to be compiled with UCLIBC_CTOR_DTOR +maa_result_t maa_init() __attribute__((constructor)); +#endif maa_result_t maa_init() {