Skip to content

Commit 906a86e

Browse files
committed
Use dllexport as RUBY_FUNC_EXPORTED on Windows
1 parent dd8903f commit 906a86e

4 files changed

Lines changed: 10 additions & 5 deletions

File tree

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1761,7 +1761,7 @@ AS_IF([test "$GCC" = yes], [
17611761
AC_CACHE_CHECK(for exported function attribute, rb_cv_func_exported, [
17621762
rb_cv_func_exported=no
17631763
RUBY_WERROR_FLAG([
1764-
for mac in '__attribute__ ((__visibility__("default")))' '__declspec(dllexport)'; do
1764+
for mac in '__declspec(dllexport)' '__attribute__ ((__visibility__("default")))'; do
17651765
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@define RUBY_FUNC_EXPORTED $mac extern
17661766
RUBY_FUNC_EXPORTED void conftest_attribute_check(void);]], [[]])],
17671767
[rb_cv_func_exported="$mac"; break])

parse.y

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,7 +1568,7 @@ static void numparam_pop(struct parser_params *p, NODE *prev_inner);
15681568
#define CASE_LABELS_ENABLED_P(case_labels) (case_labels && case_labels != CHECK_LITERAL_WHEN)
15691569

15701570
#define yytnamerr(yyres, yystr) (YYSIZE_T)rb_yytnamerr(p, yyres, yystr)
1571-
size_t rb_yytnamerr(struct parser_params *p, char *yyres, const char *yystr);
1571+
RUBY_FUNC_EXPORTED size_t rb_yytnamerr(struct parser_params *p, char *yyres, const char *yystr);
15721572

15731573
#define TOKEN2ID(tok) ( \
15741574
tTOKEN_LOCAL_BEGIN<(tok)&&(tok)<tTOKEN_LOCAL_END ? TOKEN2LOCALID(tok) : \
@@ -8613,7 +8613,6 @@ flush_string_content(struct parser_params *p, rb_encoding *enc)
86138613
dispatch_scan_event(p, tSTRING_CONTENT);
86148614
}
86158615

8616-
RUBY_FUNC_EXPORTED const uint_least32_t ruby_global_name_punct_bits[(0x7e - 0x20 + 31) / 32];
86178616
/* this can be shared with ripper, since it's independent from struct
86188617
* parser_params. */
86198618
#ifndef RIPPER
@@ -15935,7 +15934,7 @@ count_char(const char *str, int c)
1593515934
*
1593615935
* "\"`class' keyword\"" => "`class' keyword"
1593715936
*/
15938-
RUBY_FUNC_EXPORTED size_t
15937+
size_t
1593915938
rb_yytnamerr(struct parser_params *p, char *yyres, const char *yystr)
1594015939
{
1594115940
if (*yystr == '"') {

symbol.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,12 @@ sym_type(VALUE sym)
100100
#define is_class_sym(sym) (sym_type(sym)==ID_CLASS)
101101
#define is_junk_sym(sym) (sym_type(sym)==ID_JUNK)
102102

103-
RUBY_FUNC_EXPORTED const uint_least32_t ruby_global_name_punct_bits[(0x7e - 0x20 + 31) / 32];
103+
#ifndef RIPPER
104+
RUBY_FUNC_EXPORTED
105+
#else
106+
RUBY_EXTERN
107+
#endif
108+
const uint_least32_t ruby_global_name_punct_bits[(0x7e - 0x20 + 31) / 32];
104109

105110
static inline int
106111
is_global_name_punct(const int c)

win32/Makefile.sub

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,7 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub
746746
#define RBIMPL_ATTR_PACKED_STRUCT_END() __pragma(pack(pop))
747747
!endif
748748
#define RUBY_EXTERN extern __declspec(dllimport)
749+
#define RUBY_FUNC_EXPORTED extern __declspec(dllexport)
749750
#define RUBY_ALIGNAS(n) __declspec(align(n))
750751
#define RUBY_ALIGNOF __alignof
751752
#define HAVE_DECL_SYS_NERR 1

0 commit comments

Comments
 (0)