Undeclared Function strdup Using a Third Party Library in LabWindows™/CVI™

Updated Oct 20, 2022

Reported In

Software

  • LabWindows/CVI

Issue Details

I can't compile my application in LabWindows/CVI using a third-party library because the compiler does not have the declaration for the strdup function as their software uses MINGW32. Is there a replacement for this function?

Solution

The function 'strdup' is not implemented in LabWindows/CVI. There is actually another approach using the 'StrDup' that has been implemented within the toolbox.h. Users may use the following code:
 
#if defined(_CVI_)
param->key = StrDup(thisParam.key);
#else
        param->key = strdup(thisParam.key);
#endif

This implementation will make sure that the proper and existing function is used in the development environment.