This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to make BLE_NUS_C_DEF(m_ble_nus_c) a global variable

I am adapting the example ble_app_uart_c_pca10056_s140, which is a BLE Nordic Uart Service central device. I would like that other c files can access the variable m_ble_nus_c, which is declared in main.c. Normally to declare a global variable in c, you use the keyword extern and declare the variable in a header file as follows: 

extern ble_nus_c_t m_ble_nus_c;

Then in one of the local files, you initialize the variable. However, this doesn't work here. I notice that BLE_NUS_C_DEF is a #define.

What is the best way to make m_ble_nus_c a global variable?

Related