AnsweredAssumed Answered

extern "C" linkage for KSDK headers

Question asked by Max Vilimpoc on Dec 26, 2016
Latest reply on Dec 28, 2016 by xiangjun.rong

Could someone working on the next version of the Kinetis Connectivity Software SDK make sure that all of the headers are conditionally-wrapped for C linkage?

 

#ifdef __cplusplus
extern "C" {
#endif

...

#ifdef __cplusplus
}
#endif

 

This isn't currently the case with most of the headers from the v1.0.2 Connectivity Software SDK.

Not exposing using C linkage leads to the usual errors when called from C++ files:

 

./source/Coordinator.o: In function `MLME_NWK_SapHandler(nwkMessage_tag*, unsigned long)':
/../source/Coordinator.cpp:929: undefined reference to `ListAddTailMsg(list_tag*, void*)'
./source/Coordinator.o: In function `MCPS_NWK_SapHandler(mcpsToNwkMessage_tag*, unsigned long)':
/../source/Coordinator.cpp:937: undefined reference to `ListAddTailMsg(list_tag*, void*)'
./source/Coordinator.o: In function `App_init':
/../source/Coordinator.cpp:964: undefined reference to `ListInit(list_tag*, unsigned long)'
/../source/Coordinator.cpp:965: undefined reference to `ListInit(list_tag*, unsigned long)'
/../source/Coordinator.cpp:968: undefined reference to `Mac_SetExtendedAddress(unsigned char*, unsigned long)'
./source/Coordinator.o: In function `AppThread(void*)':
/../source/Coordinator.cpp:1017: undefined reference to `ListRemoveHeadMsg(list_tag*)'
/../source/Coordinator.cpp:1150: undefined reference to `ListRemoveHeadMsg(list_tag*)'
./source/Coordinator.o: In function `coordinator_main_task':
/../source/Coordinator.cpp:1203: undefined reference to `TMR_Init()'
/../source/Coordinator.cpp:1205: undefined reference to `SecLib_Init()'
/../source/Coordinator.cpp:1208: undefined reference to `RNG_Init()'

 

I've added this wrapping to copies of the headers in my project (cloned with the Project Cloner), but it would be great to see this upstream.

Outcomes