I have an array of function pointers that I'd like to ensure stays in program memory, rather than consume RAM. However, when I add the "const" keyword, I get a compiler error. Here is the code as it exists without the compiler error:
PmReturn_t (* usr_nat_fxn_table[])(pPmFrame_t *) =
{
nat_placeholder_func,
nat_01_mbed___init__,
nat_02_mbed_read_u16,
/* ... many more funcs ... */
};
Here is how I insert "const":
PmReturn_t (* const usr_nat_fxn_table[])(pPmFrame_t *) =
{
nat_placeholder_func,
nat_01_mbed___init__,
nat_02_mbed_read_u16,
/* ... many more funcs ... */
};
The compiler error is "Undefined symbol usr_nat_fxn_table"
The place to insert const is at src/platform/mbed/main_nat.c:1569
The table is used in src/vm/interp.c:32 and 2032
Does my C-like understanding of const not apply to a C++ compiler?
!!Dean
I have an array of function pointers that I'd like to ensure stays in program memory, rather than consume RAM. However, when I add the "const" keyword, I get a compiler error. Here is the code as it exists without the compiler error:
The place to insert const is at src/platform/mbed/main_nat.c:1569
The table is used in src/vm/interp.c:32 and 2032
Does my C-like understanding of const not apply to a C++ compiler?