TFLM: Make main_functions C friendly.

With extern "C", C++ compiler will skip naming mangling on these methods so that they can be called in C program, which many embedded developers use.

PiperOrigin-RevId: 290270585
Change-Id: I2d302325e9c6bc3d16608a424767cfa44ea51816
This commit is contained in:
Tiezhen WANG 2020-01-17 07:58:44 -08:00 committed by TensorFlower Gardener
parent 2323473cd9
commit 29ca6a1d5b
4 changed files with 36 additions and 0 deletions

View File

@ -16,6 +16,11 @@ limitations under the License.
#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_MAIN_FUNCTIONS_H_ #ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_MAIN_FUNCTIONS_H_
#define TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_MAIN_FUNCTIONS_H_ #define TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_MAIN_FUNCTIONS_H_
// Expose a C friendly interface for main functions.
#ifdef __cplusplus
extern "C" {
#endif
// Initializes all data needed for the example. The name is important, and needs // Initializes all data needed for the example. The name is important, and needs
// to be setup() for Arduino compatibility. // to be setup() for Arduino compatibility.
void setup(); void setup();
@ -25,4 +30,8 @@ void setup();
// compatibility. // compatibility.
void loop(); void loop();
#ifdef __cplusplus
}
#endif
#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_MAIN_FUNCTIONS_H_ #endif // TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_MAIN_FUNCTIONS_H_

View File

@ -16,6 +16,11 @@ limitations under the License.
#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_MAIN_FUNCTIONS_H_ #ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_MAIN_FUNCTIONS_H_
#define TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_MAIN_FUNCTIONS_H_ #define TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_MAIN_FUNCTIONS_H_
// Expose a C friendly interface for main functions.
#ifdef __cplusplus
extern "C" {
#endif
// Initializes all data needed for the example. The name is important, and needs // Initializes all data needed for the example. The name is important, and needs
// to be setup() for Arduino compatibility. // to be setup() for Arduino compatibility.
void setup(); void setup();
@ -25,4 +30,8 @@ void setup();
// compatibility. // compatibility.
void loop(); void loop();
#ifdef __cplusplus
}
#endif
#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_MAIN_FUNCTIONS_H_ #endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_MAIN_FUNCTIONS_H_

View File

@ -16,6 +16,11 @@ limitations under the License.
#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MAIN_FUNCTIONS_H_ #ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MAIN_FUNCTIONS_H_
#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MAIN_FUNCTIONS_H_ #define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MAIN_FUNCTIONS_H_
// Expose a C friendly interface for main functions.
#ifdef __cplusplus
extern "C" {
#endif
// Initializes all data needed for the example. The name is important, and needs // Initializes all data needed for the example. The name is important, and needs
// to be setup() for Arduino compatibility. // to be setup() for Arduino compatibility.
void setup(); void setup();
@ -25,4 +30,8 @@ void setup();
// compatibility. // compatibility.
void loop(); void loop();
#ifdef __cplusplus
}
#endif
#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MAIN_FUNCTIONS_H_ #endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MAIN_FUNCTIONS_H_

View File

@ -16,6 +16,11 @@ limitations under the License.
#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_MAIN_FUNCTIONS_H_ #ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_MAIN_FUNCTIONS_H_
#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_MAIN_FUNCTIONS_H_ #define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_MAIN_FUNCTIONS_H_
// Expose a C friendly interface for main functions.
#ifdef __cplusplus
extern "C" {
#endif
// Initializes all data needed for the example. The name is important, and needs // Initializes all data needed for the example. The name is important, and needs
// to be setup() for Arduino compatibility. // to be setup() for Arduino compatibility.
void setup(); void setup();
@ -25,4 +30,8 @@ void setup();
// compatibility. // compatibility.
void loop(); void loop();
#ifdef __cplusplus
}
#endif
#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_MAIN_FUNCTIONS_H_ #endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_MAIN_FUNCTIONS_H_