mraa.c: stop ctor running in scripting languages
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
@@ -177,13 +177,13 @@ typedef struct {
|
|||||||
*
|
*
|
||||||
* @return Result of operation
|
* @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()
|
// 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
|
// be called as a constructor make sure your libc supports this! uclibc needs
|
||||||
// to be compiled with UCLIBC_CTOR_DTOR
|
// to be compiled with UCLIBC_CTOR_DTOR
|
||||||
mraa_result_t mraa_init() __attribute__((constructor));
|
mraa_result_t mraa_init() __attribute__((constructor));
|
||||||
#else
|
|
||||||
mraa_result_t mraa_init();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
13
src/mraa.c
13
src/mraa.c
@@ -45,13 +45,16 @@ mraa_get_version()
|
|||||||
return gVERSION;
|
return gVERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SWIG
|
#if 0
|
||||||
|
const mraa_adv_func*
|
||||||
|
mraa_get_advance()
|
||||||
|
{
|
||||||
|
return (const mraa_adv_func*) advance;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
mraa_result_t
|
mraa_result_t
|
||||||
mraa_init()
|
mraa_init()
|
||||||
#else
|
|
||||||
mraa_result_t __attribute__((constructor))
|
|
||||||
mraa_init()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
/** Once more board definitions have been added,
|
/** Once more board definitions have been added,
|
||||||
* A method for detecting them will need to be devised.
|
* A method for detecting them will need to be devised.
|
||||||
|
|||||||
Reference in New Issue
Block a user