DSM Backward Compatibility

Weak link is a property of Apple’s development framework which ensures backward compatibility. GCC has a similar property called “weak symbol.” We utilize this capability to provide a weak link framework in libsynosdk for backward compatibility as well. You can find available headers in usr/syno/include/libsynosdk under chroot environment. Each function prototype in synosdk/*_p.h is labeled with a macro telling you when this function is added into libsynosdk. Therefore, you can input a function in DSM 4.2 as follows:

/* DO NOT include *_p.h directly */
#include <synosdk/user.h>
#include <synosdk/service.h>

/* example, SYNOServiceHomePathCheck is available since DSM 4.2 */
if (SYNOServiceHomePathCheck) {
    SYNOServiceHomePathCheck(szPath, TRUE, TRUE, &pResult);
} else {
    /* implement alternative to SYNOServiceHomePathCheck here */

As a result, when your application runs in DSM 4.2 and later, function SYNOServiceHomePathCheck in libsynosdk.so is invoked. In DSM 4.2 and older, else-part will be executed as a replacement to SYNOServiceHomePathCheck.