cesanta / v7

Embedded JavaScript engine for C/C++
Other
1.43k stars 177 forks source link

Don't redefine strnlen() on Win32 and WinRT #523

Closed swisspol closed 8 years ago

swisspol commented 8 years ago

It already exists:

Warning C4273   'strnlen' : inconsistent dll linkage    WindowsRuntimeComponent1    c:\users\pol\documents\github\cross\v7\v7.c 1424    

This makes linking fail on Win32 (but not on WinRT for some strange reason).

swisspol commented 8 years ago

The fix is simply to remove Win32 from the #if in

#if (!(defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 700) &&           \
     !(defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L) &&   \
     !(defined(__DARWIN_C_LEVEL) && __DARWIN_C_LEVEL >= 200809L) && \
     !defined(RTOS_SDK))
#define _MG_PROVIDE_STRNLEN
size_t strnlen(const char *s, size_t maxlen);
#endif
cpq commented 8 years ago

Dmitry please take care of this