Use dllexport as RUBY_FUNC_EXPORTED on Windows

This commit is contained in:
Nobuyoshi Nakada 2024-06-09 16:55:27 +09:00
parent dd8903fed7
commit 906a86e4de
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465
4 changed files with 10 additions and 5 deletions

View File

@ -1761,7 +1761,7 @@ AS_IF([test "$GCC" = yes], [
AC_CACHE_CHECK(for exported function attribute, rb_cv_func_exported, [ AC_CACHE_CHECK(for exported function attribute, rb_cv_func_exported, [
rb_cv_func_exported=no rb_cv_func_exported=no
RUBY_WERROR_FLAG([ RUBY_WERROR_FLAG([
for mac in '__attribute__ ((__visibility__("default")))' '__declspec(dllexport)'; do for mac in '__declspec(dllexport)' '__attribute__ ((__visibility__("default")))'; do
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@define RUBY_FUNC_EXPORTED $mac extern AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@define RUBY_FUNC_EXPORTED $mac extern
RUBY_FUNC_EXPORTED void conftest_attribute_check(void);]], [[]])], RUBY_FUNC_EXPORTED void conftest_attribute_check(void);]], [[]])],
[rb_cv_func_exported="$mac"; break]) [rb_cv_func_exported="$mac"; break])

View File

@ -1568,7 +1568,7 @@ static void numparam_pop(struct parser_params *p, NODE *prev_inner);
#define CASE_LABELS_ENABLED_P(case_labels) (case_labels && case_labels != CHECK_LITERAL_WHEN) #define CASE_LABELS_ENABLED_P(case_labels) (case_labels && case_labels != CHECK_LITERAL_WHEN)
#define yytnamerr(yyres, yystr) (YYSIZE_T)rb_yytnamerr(p, yyres, yystr) #define yytnamerr(yyres, yystr) (YYSIZE_T)rb_yytnamerr(p, yyres, yystr)
size_t rb_yytnamerr(struct parser_params *p, char *yyres, const char *yystr); RUBY_FUNC_EXPORTED size_t rb_yytnamerr(struct parser_params *p, char *yyres, const char *yystr);
#define TOKEN2ID(tok) ( \ #define TOKEN2ID(tok) ( \
tTOKEN_LOCAL_BEGIN<(tok)&&(tok)<tTOKEN_LOCAL_END ? TOKEN2LOCALID(tok) : \ tTOKEN_LOCAL_BEGIN<(tok)&&(tok)<tTOKEN_LOCAL_END ? TOKEN2LOCALID(tok) : \
@ -8613,7 +8613,6 @@ flush_string_content(struct parser_params *p, rb_encoding *enc)
dispatch_scan_event(p, tSTRING_CONTENT); dispatch_scan_event(p, tSTRING_CONTENT);
} }
RUBY_FUNC_EXPORTED const uint_least32_t ruby_global_name_punct_bits[(0x7e - 0x20 + 31) / 32];
/* this can be shared with ripper, since it's independent from struct /* this can be shared with ripper, since it's independent from struct
* parser_params. */ * parser_params. */
#ifndef RIPPER #ifndef RIPPER
@ -15935,7 +15934,7 @@ count_char(const char *str, int c)
* *
* "\"`class' keyword\"" => "`class' keyword" * "\"`class' keyword\"" => "`class' keyword"
*/ */
RUBY_FUNC_EXPORTED size_t size_t
rb_yytnamerr(struct parser_params *p, char *yyres, const char *yystr) rb_yytnamerr(struct parser_params *p, char *yyres, const char *yystr)
{ {
if (*yystr == '"') { if (*yystr == '"') {

View File

@ -100,7 +100,12 @@ sym_type(VALUE sym)
#define is_class_sym(sym) (sym_type(sym)==ID_CLASS) #define is_class_sym(sym) (sym_type(sym)==ID_CLASS)
#define is_junk_sym(sym) (sym_type(sym)==ID_JUNK) #define is_junk_sym(sym) (sym_type(sym)==ID_JUNK)
RUBY_FUNC_EXPORTED const uint_least32_t ruby_global_name_punct_bits[(0x7e - 0x20 + 31) / 32]; #ifndef RIPPER
RUBY_FUNC_EXPORTED
#else
RUBY_EXTERN
#endif
const uint_least32_t ruby_global_name_punct_bits[(0x7e - 0x20 + 31) / 32];
static inline int static inline int
is_global_name_punct(const int c) is_global_name_punct(const int c)

View File

@ -746,6 +746,7 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub
#define RBIMPL_ATTR_PACKED_STRUCT_END() __pragma(pack(pop)) #define RBIMPL_ATTR_PACKED_STRUCT_END() __pragma(pack(pop))
!endif !endif
#define RUBY_EXTERN extern __declspec(dllimport) #define RUBY_EXTERN extern __declspec(dllimport)
#define RUBY_FUNC_EXPORTED extern __declspec(dllexport)
#define RUBY_ALIGNAS(n) __declspec(align(n)) #define RUBY_ALIGNAS(n) __declspec(align(n))
#define RUBY_ALIGNOF __alignof #define RUBY_ALIGNOF __alignof
#define HAVE_DECL_SYS_NERR 1 #define HAVE_DECL_SYS_NERR 1