This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem with rand_r() and strnlen()

Hello,
I am currently currently using the ARM 6.6.1 compiler and running into an issue while using the rand_r() and strnlen() functions in the code below,
static inline uint32_t MCM_RandR(uint32_t *const aSeed)
{
    return rand_r((unsigned int*)aSeed);
}

This results in the following error:
      implicit declaration of function 'rand_r' is invalid in C99 [-Wimplicit-function-declaration]
    return rand_r((unsigned int*)aSeed);
Similarly I am running into a similar issue with the strnlen function which gives the below error when compiling,
      warning: implicit declaration of function 'strnlen' is invalid in C99 [-Wimplicit-function-declaration]
    len = strnlen(logBuf, ULOG_STR_MAX_SIZE);
The above code and both function calls compile fine with the ARM 6.6.2 compiler version, however with the 6.6.1 version I am getting the above errors.
Are these functions not supported in the 6.6.1 compiler as they are in 6.6.2? Are there any compiler options or settings that might enable their support in 6.6.1?
Would appreciate any feedback and thank you in advance for your help.
  • Hello skysurf99,

    I recommend contacting Arm's technical support team directly on this, via the links in the menu at top of page (Support -> Open a support case).

    Regards

    Ronan

  • An "implicit declaration" means that you have failed to provide an explicit one; eg, a prototype  - which is usually due to a missing header file.

    The above code and both function calls compile fine with the ARM 6.6.2 compiler version

    So, in that version, see where those things are getting declared.

    Then look at the 6.6.1 version to see what's different ...