ruby/yarp/defines.h
Jemma Issroff 45740e7a24 [ruby/yarp] Use _snprintf when using Windows versions prior to 2015 (< 1900)
Ruby CI has informed us that snprintf is not available on Windows
versions, but _sprintf is supported. This commit allows us to use
_sprintf where applicable

https://github.com/ruby/yarp/commit/818cc96afe
2023-08-16 17:47:32 -07:00

45 lines
1004 B
C

#ifndef YARP_DEFINES_H
#define YARP_DEFINES_H
// This file should be included first by any *.h or *.c in YARP
#include <ctype.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
// YP_EXPORTED_FUNCTION
#ifndef YP_EXPORTED_FUNCTION
# ifdef YP_EXPORT_SYMBOLS
# ifdef _WIN32
# define YP_EXPORTED_FUNCTION __declspec(dllexport) extern
# else
# define YP_EXPORTED_FUNCTION __attribute__((__visibility__("default"))) extern
# endif
# else
# define YP_EXPORTED_FUNCTION
# endif
#endif
// YP_ATTRIBUTE_UNUSED
#if defined(__GNUC__)
# define YP_ATTRIBUTE_UNUSED __attribute__((unused))
#else
# define YP_ATTRIBUTE_UNUSED
#endif
// inline
#if defined(_MSC_VER) && !defined(inline)
# define inline __inline
#endif
// Windows versions before 2015 use _snprintf
#if defined(_MSC_VER) && (_MSC_VER < 1900)
# define snprintf _snprintf
#endif
int yp_strncasecmp(const char *string1, const char *string2, size_t length);
#endif