Private
Public Access
2
0

mraa.c: stop ctor running in scripting languages

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2014-07-01 17:05:57 +01:00
parent 437e26781c
commit eec08ac97b
2 changed files with 11 additions and 8 deletions

View File

@@ -177,13 +177,13 @@ typedef struct {
*
* @return Result of operation
*/
#ifndef SWIG
#if (defined SWIGPYTHON) || (defined SWIG)
mraa_result_t mraa_init();
#else
// this sets a compiler attribute (supported by GCC & clang) to have mraa_init()
// be called as a constructor make sure your libc supports this! uclibc needs
// to be compiled with UCLIBC_CTOR_DTOR
mraa_result_t mraa_init() __attribute__((constructor));
#else
mraa_result_t mraa_init();
#endif
/**

View File

@@ -45,13 +45,16 @@ mraa_get_version()
return gVERSION;
}
#ifdef SWIG
#if 0
const mraa_adv_func*
mraa_get_advance()
{
return (const mraa_adv_func*) advance;
}
#endif
mraa_result_t
mraa_init()
#else
mraa_result_t __attribute__((constructor))
mraa_init()
#endif
{
/** Once more board definitions have been added,
* A method for detecting them will need to be devised.