Skip to content

Commit

Permalink
Fix linking of API use from C++ code
Browse files Browse the repository at this point in the history
Declare all functions as extern "C".
  • Loading branch information
QRPp committed Apr 2, 2021
1 parent 8b7d763 commit d22fd85
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/mgos_homeassistant.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,16 @@
#pragma once

#include "mgos_homeassistant_api.h"

#ifdef __cplusplus
extern "C" {
#endif

struct mgos_homeassistant *mgos_homeassistant_get_global(void);
bool mgos_homeassistant_fromfile(struct mgos_homeassistant *ha, const char *filename);
bool mgos_homeassistant_fromjson(struct mgos_homeassistant *ha, const char *json);
bool mgos_homeassistant_clear(struct mgos_homeassistant *ha);

#ifdef __cplusplus
}
#endif
8 changes: 8 additions & 0 deletions include/mgos_homeassistant_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ struct mgos_homeassistant_handler {
SLIST_ENTRY(mgos_homeassistant_handler) entry;
};

#ifdef __cplusplus
extern "C" {
#endif

bool mgos_homeassistant_send_config(struct mgos_homeassistant *ha);
bool mgos_homeassistant_send_status(struct mgos_homeassistant *ha);
bool mgos_homeassistant_add_handler(struct mgos_homeassistant *ha, ha_ev_handler ev_handler, void *user_data);
Expand All @@ -147,3 +151,7 @@ struct mgos_homeassistant_object_class *mgos_homeassistant_object_class_get(stru
bool mgos_homeassistant_object_class_send_status(struct mgos_homeassistant_object_class *c);
bool mgos_homeassistant_object_class_send_config(struct mgos_homeassistant_object_class *c);
bool mgos_homeassistant_object_class_remove(struct mgos_homeassistant_object_class **c);

#ifdef __cplusplus
}
#endif

0 comments on commit d22fd85

Please sign in to comment.