Skip to content

Commit bf5a8f0

Browse files
committed
fix: global vars in .h cause multiple definition errors
fix: __loopHook causes multiple definition error
1 parent 3a47f86 commit bf5a8f0

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/bridge.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ class BridgeClassUpdater {
275275
BridgeClassUpdater() = delete; // prevents instantiation
276276
};
277277

278-
BridgeClass Bridge(Serial1);
278+
inline BridgeClass Bridge(Serial1);
279279

280280
inline void updateEntryPoint(void *, void *, void *){
281281
while (true) {
@@ -291,7 +291,7 @@ static void safeUpdate(){
291291
}
292292

293293
// leave as is
294-
void __loopHook(void){
294+
void __attribute__((weak)) __loopHook(void){
295295
k_yield();
296296
safeUpdate();
297297
}

src/hci.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ template<size_t BufferSize=HCI_BUFFER_SIZE> class BridgeHCI {
149149
extern BridgeClass Bridge;
150150

151151
namespace RouterBridge {
152-
BridgeHCI<> HCI(Bridge);
152+
inline BridgeHCI<> HCI(Bridge);
153153
}
154154

155155
// Make available in global namespace for backward compatibility

src/monitor.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ class BridgeMonitor: public Stream {
156156
};
157157

158158
extern BridgeClass Bridge;
159-
BridgeMonitor<> Monitor(Bridge);
159+
160+
inline BridgeMonitor<> Monitor(Bridge);
160161

161162
#endif // BRIDGE_MONITOR_H

0 commit comments

Comments
 (0)