summaryrefslogtreecommitdiff
path: root/math/rubygem-rb-gsl/files/patch-ruby3
blob: 866a7ffa6ab0dfb16a1a0c17af91343251e1cb23 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
diff --git .travis.yml .travis.yml
index e69c107..849e6aa 100644
--- .travis.yml
+++ .travis.yml
@@ -8,11 +8,15 @@ rvm:
   - 2.2.6
   - 2.3.3
   - 2.4.0
+  - 2.5
+  - 2.6
+  - 2.7
+  - 3.0.0
 
 before_install:
   - sudo apt-get update -qq
   - sudo apt-get install -y libgsl0-dev
-  - gem update bundler
-  - bundle install
+  - gem install bundler:1.17.3
+  - bundle _1.17.3_ install
   - bundle exec rake compile
   - bundle exec rake test
diff --git ext/gsl_native/extconf.rb ext/gsl_native/extconf.rb
index 2c712b3..982bad8 100644
--- ext/gsl_native/extconf.rb
+++ ext/gsl_native/extconf.rb
@@ -21,6 +21,7 @@ def create_conf_h(file) #:nodoc:
 
     # FIXME: Find a better way to do this:
     hfile.puts "#define RUBY_2 1" if RUBY_VERSION >= '2.0'
+    hfile.puts "#define RUBY_3 1" if RUBY_VERSION >= '3.0'
 
     for line in $defs
       line =~ /^-D(.*)/
diff --git ext/gsl_native/gsl_narray.c ext/gsl_native/gsl_narray.c
index ba895e6..a4a90d9 100644
--- ext/gsl_native/gsl_narray.c
+++ ext/gsl_native/gsl_narray.c
@@ -570,7 +570,7 @@ gsl_matrix_int_view* na_to_gm_int_view(VALUE nna)
 }
 
 #include <gsl/gsl_histogram.h>
-EXTERN VALUE cgsl_histogram;
+extern VALUE cgsl_histogram;
 static VALUE rb_gsl_narray_histogram(int argc, VALUE *argv, VALUE obj)
 {
   double *ptr, *ptr_range;
diff --git ext/gsl_native/include/rb_gsl.h ext/gsl_native/include/rb_gsl.h
index bc1d6c0..aa643e6 100644
--- ext/gsl_native/include/rb_gsl.h
+++ ext/gsl_native/include/rb_gsl.h
@@ -109,7 +109,7 @@ void Init_tensor_int_init(VALUE module);
 
 void Init_gsl_dirac(VALUE module);
 
-EXTERN VALUE cGSL_Object;
+extern VALUE cGSL_Object;
 
 void Init_tamu_anova(VALUE module);
 
diff --git ext/gsl_native/include/rb_gsl_array.h ext/gsl_native/include/rb_gsl_array.h
index 447679d..e4d4440 100644
--- ext/gsl_native/include/rb_gsl_array.h
+++ ext/gsl_native/include/rb_gsl_array.h
@@ -29,41 +29,41 @@
 typedef gsl_permutation gsl_index;
 
 #ifdef HAVE_NARRAY_H
-EXTERN VALUE cNArray;
+extern VALUE cNArray;
 #endif
 
 #ifdef HAVE_NMATRIX_H
-EXTERN VALUE cNMatrix;
+extern VALUE cNMatrix;
 #endif
 
-EXTERN VALUE cgsl_block, cgsl_block_int;
-EXTERN VALUE cgsl_block_uchar;
-EXTERN VALUE cgsl_block_complex;
-EXTERN VALUE cgsl_vector, cgsl_vector_complex;
-EXTERN VALUE cgsl_vector_col;
-EXTERN VALUE cgsl_vector_col_view;
-EXTERN VALUE cgsl_vector_complex_col;
-EXTERN VALUE cgsl_vector_complex_col_view;
-EXTERN VALUE cgsl_vector_view, cgsl_vector_complex_view;
-EXTERN VALUE cgsl_vector_view_ro, cgsl_vector_col_view_ro;
-EXTERN VALUE cgsl_vector_complex_view_ro;
-
-EXTERN VALUE cgsl_vector_int, cgsl_vector_int_col;
-EXTERN VALUE cgsl_vector_int_view, cgsl_vector_int_col_view;
-EXTERN VALUE cgsl_vector_int_view_ro, cgsl_vector_int_col_view_ro;
-
-EXTERN VALUE cgsl_matrix, cgsl_matrix_complex;
-EXTERN VALUE cgsl_matrix_view_ro;
-EXTERN VALUE cgsl_matrix_complex_view_ro;
-EXTERN VALUE cgsl_matrix_view, cgsl_matrix_complex_view;
-EXTERN VALUE cgsl_matrix_int, cgsl_matrix_int_view;
-EXTERN VALUE cgsl_matrix_int_view_ro;
-EXTERN VALUE cgsl_permutation;
-EXTERN VALUE cgsl_index;
-EXTERN VALUE cgsl_function;
-EXTERN VALUE mgsl_narray;
-
-EXTERN VALUE mDirac;
+extern VALUE cgsl_block, cgsl_block_int;
+extern VALUE cgsl_block_uchar;
+extern VALUE cgsl_block_complex;
+extern VALUE cgsl_vector, cgsl_vector_complex;
+extern VALUE cgsl_vector_col;
+extern VALUE cgsl_vector_col_view;
+extern VALUE cgsl_vector_complex_col;
+extern VALUE cgsl_vector_complex_col_view;
+extern VALUE cgsl_vector_view, cgsl_vector_complex_view;
+extern VALUE cgsl_vector_view_ro, cgsl_vector_col_view_ro;
+extern VALUE cgsl_vector_complex_view_ro;
+
+extern VALUE cgsl_vector_int, cgsl_vector_int_col;
+extern VALUE cgsl_vector_int_view, cgsl_vector_int_col_view;
+extern VALUE cgsl_vector_int_view_ro, cgsl_vector_int_col_view_ro;
+
+extern VALUE cgsl_matrix, cgsl_matrix_complex;
+extern VALUE cgsl_matrix_view_ro;
+extern VALUE cgsl_matrix_complex_view_ro;
+extern VALUE cgsl_matrix_view, cgsl_matrix_complex_view;
+extern VALUE cgsl_matrix_int, cgsl_matrix_int_view;
+extern VALUE cgsl_matrix_int_view_ro;
+extern VALUE cgsl_permutation;
+extern VALUE cgsl_index;
+extern VALUE cgsl_function;
+extern VALUE mgsl_narray;
+
+extern VALUE mDirac;
 
 gsl_matrix_view* gsl_matrix_view_alloc();
 void gsl_matrix_view_free(gsl_matrix_view * mv);
diff --git ext/gsl_native/include/rb_gsl_common.h ext/gsl_native/include/rb_gsl_common.h
index e3365b0..44f23aa 100644
--- ext/gsl_native/include/rb_gsl_common.h
+++ ext/gsl_native/include/rb_gsl_common.h
@@ -25,8 +25,9 @@
 #include <gsl/gsl_ieee_utils.h>
 #include "rb_gsl_with_narray.h"
 #include "rb_gsl_with_nmatrix.h"
+#include "gsl_config.h"
 
-EXTERN ID rb_gsl_id_beg, rb_gsl_id_end, rb_gsl_id_excl, rb_gsl_id_to_a;
+extern ID rb_gsl_id_beg, rb_gsl_id_end, rb_gsl_id_excl, rb_gsl_id_to_a;
 
 #ifndef CHECK_FIXNUM
 #define CHECK_FIXNUM(x) if(!FIXNUM_P(x)) rb_raise(rb_eTypeError,"Fixnum expected");
@@ -292,7 +293,9 @@ EXTERN ID rb_gsl_id_beg, rb_gsl_id_end, rb_gsl_id_excl, rb_gsl_id_to_a;
 #endif
 
 #ifndef RBGSL_SET_CLASS
-#ifdef RB_OBJ_WRITE
+#if defined(RUBY_3)
+#define RBGSL_SET_CLASS0(obj0, cls) RB_OBJ_WRITE(obj0, &(RBASIC(obj0)->klass), cls)
+#elif defined(RB_OBJ_WRITE)
 #define RBGSL_SET_CLASS0(obj0, cls) RB_OBJ_WRITE(obj0, &(RBASIC_CLASS(obj0)), cls)
 #else
 #define RBGSL_SET_CLASS0(obj0, cls) RBASIC(obj0)->klass = cls
@@ -349,5 +352,5 @@ VALUE rb_gsl_nary_eval1(VALUE ary, double (*f)(double));
 VALUE rb_gsl_nmatrix_eval1(VALUE ary, double (*f)(double));
 #endif
 
-EXTERN VALUE cGSL_Object;
+extern VALUE cGSL_Object;
 #endif
diff --git ext/gsl_native/include/rb_gsl_complex.h ext/gsl_native/include/rb_gsl_complex.h
index 6243311..4747f84 100644
--- ext/gsl_native/include/rb_gsl_complex.h
+++ ext/gsl_native/include/rb_gsl_complex.h
@@ -18,7 +18,7 @@
 #include <gsl/gsl_complex.h>
 #include <gsl/gsl_complex_math.h>
 
-EXTERN VALUE cgsl_complex;
+extern VALUE cgsl_complex;
 VALUE rb_gsl_complex_pow(int argc, VALUE *argv, VALUE obj);
 VALUE rb_gsl_complex_pow_real(int argc, VALUE *argv, VALUE obj);
 
diff --git ext/gsl_native/include/rb_gsl_const.h ext/gsl_native/include/rb_gsl_const.h
index c46b61b..735480a 100644
--- ext/gsl_native/include/rb_gsl_const.h
+++ ext/gsl_native/include/rb_gsl_const.h
@@ -18,6 +18,6 @@
 #include <gsl/gsl_const_cgsm.h>
 #include <gsl/gsl_const_num.h>
 
-EXTERN VALUE mgsl_const_mks, mgsl_const_cgs;
+extern VALUE mgsl_const_mks, mgsl_const_cgs;
 
 #endif
diff --git ext/gsl_native/include/rb_gsl_fft.h ext/gsl_native/include/rb_gsl_fft.h
index 8de6449..a220ae2 100644
--- ext/gsl_native/include/rb_gsl_fft.h
+++ ext/gsl_native/include/rb_gsl_fft.h
@@ -39,11 +39,11 @@ enum {
   RB_GSL_FFT_COPY,
 };
 
-EXTERN VALUE mgsl_fft;
-EXTERN VALUE cgsl_fft_wavetable;
-EXTERN VALUE cgsl_fft_wavetable_factor;
-EXTERN VALUE cgsl_fft_complex_wavetable, cgsl_fft_complex_workspace;
-EXTERN VALUE cgsl_fft_real_wavetable, cgsl_fft_halfcomplex_wavetable;
-EXTERN VALUE cgsl_fft_real_workspace;
+extern VALUE mgsl_fft;
+extern VALUE cgsl_fft_wavetable;
+extern VALUE cgsl_fft_wavetable_factor;
+extern VALUE cgsl_fft_complex_wavetable, cgsl_fft_complex_workspace;
+extern VALUE cgsl_fft_real_wavetable, cgsl_fft_halfcomplex_wavetable;
+extern VALUE cgsl_fft_real_workspace;
 
 #endif
diff --git ext/gsl_native/include/rb_gsl_fit.h ext/gsl_native/include/rb_gsl_fit.h
index 3b38e6b..c32805b 100644
--- ext/gsl_native/include/rb_gsl_fit.h
+++ ext/gsl_native/include/rb_gsl_fit.h
@@ -18,6 +18,6 @@
 #include <gsl/gsl_multifit_nlin.h>
 #include "rb_gsl_array.h"
 
-EXTERN VALUE mgsl_multifit;
+extern VALUE mgsl_multifit;
 
 #endif
diff --git ext/gsl_native/include/rb_gsl_function.h ext/gsl_native/include/rb_gsl_function.h
index 207e21e..71bb67f 100644
--- ext/gsl_native/include/rb_gsl_function.h
+++ ext/gsl_native/include/rb_gsl_function.h
@@ -15,8 +15,8 @@
 
 #include "rb_gsl.h"
 
-EXTERN VALUE cgsl_function;
-EXTERN VALUE cgsl_function_fdf;
+extern VALUE cgsl_function;
+extern VALUE cgsl_function_fdf;
 extern ID RBGSL_ID_call, RBGSL_ID_arity;
 void gsl_function_mark(gsl_function *f);
 void gsl_function_free(gsl_function *f);
diff --git ext/gsl_native/include/rb_gsl_histogram.h ext/gsl_native/include/rb_gsl_histogram.h
index 02a9b7b..a0635ac 100644
--- ext/gsl_native/include/rb_gsl_histogram.h
+++ ext/gsl_native/include/rb_gsl_histogram.h
@@ -18,11 +18,11 @@
 #include <gsl/gsl_histogram2d.h>
 #include "rb_gsl.h"
 
-EXTERN VALUE cgsl_histogram;
-EXTERN VALUE cgsl_histogram_range;
-EXTERN VALUE cgsl_histogram_bin;
-EXTERN VALUE cgsl_histogram2d;
-EXTERN VALUE cgsl_histogram2d_view;
+extern VALUE cgsl_histogram;
+extern VALUE cgsl_histogram_range;
+extern VALUE cgsl_histogram_bin;
+extern VALUE cgsl_histogram2d;
+extern VALUE cgsl_histogram2d_view;
 
 typedef struct {
   gsl_histogram h;
diff --git ext/gsl_native/include/rb_gsl_poly.h ext/gsl_native/include/rb_gsl_poly.h
index 02422ca..76e0a9d 100644
--- ext/gsl_native/include/rb_gsl_poly.h
+++ ext/gsl_native/include/rb_gsl_poly.h
@@ -17,12 +17,12 @@
 #include "rb_gsl_complex.h"
 #include "rb_gsl_array.h"
 
-EXTERN VALUE cgsl_poly;
-EXTERN VALUE cgsl_poly_int;
-EXTERN VALUE cgsl_poly_dd;
-EXTERN VALUE cgsl_poly_taylor;
-EXTERN VALUE cgsl_poly_workspace;
-EXTERN VALUE cgsl_rational;
+extern VALUE cgsl_poly;
+extern VALUE cgsl_poly_int;
+extern VALUE cgsl_poly_dd;
+extern VALUE cgsl_poly_taylor;
+extern VALUE cgsl_poly_workspace;
+extern VALUE cgsl_rational;
 
 typedef gsl_vector gsl_poly;
 typedef gsl_vector_int gsl_poly_int;
diff --git ext/gsl_native/include/rb_gsl_rng.h ext/gsl_native/include/rb_gsl_rng.h
index 796c4ee..f656365 100644
--- ext/gsl_native/include/rb_gsl_rng.h
+++ ext/gsl_native/include/rb_gsl_rng.h
@@ -15,6 +15,6 @@
 #include <gsl/gsl_rng.h>
 #include "rb_gsl.h"
 
-EXTERN VALUE cgsl_rng;
+extern VALUE cgsl_rng;
 
 #endif
diff --git ext/gsl_native/include/rb_gsl_root.h ext/gsl_native/include/rb_gsl_root.h
index 6b68bab..0d98dd4 100644
--- ext/gsl_native/include/rb_gsl_root.h
+++ ext/gsl_native/include/rb_gsl_root.h
@@ -16,7 +16,7 @@
 #include <gsl/gsl_roots.h>
 #include "rb_gsl.h"
 
-EXTERN VALUE cgsl_fsolver;
-EXTERN VALUE cgsl_fdfsolver;
+extern VALUE cgsl_fsolver;
+extern VALUE cgsl_fdfsolver;
 
 #endif
diff --git ext/gsl_native/include/rb_gsl_sf.h ext/gsl_native/include/rb_gsl_sf.h
index 9a61cec..65f5e12 100644
--- ext/gsl_native/include/rb_gsl_sf.h
+++ ext/gsl_native/include/rb_gsl_sf.h
@@ -16,7 +16,7 @@
 #include <gsl/gsl_sf_mathieu.h>
 #include "rb_gsl.h"
 
-EXTERN VALUE cgsl_sf_result, cgsl_sf_result_e10;
+extern VALUE cgsl_sf_result, cgsl_sf_result_e10;
 
 VALUE rb_gsl_sf_result_new(VALUE klass);
 
diff --git ext/gsl_native/include/rb_gsl_tensor.h ext/gsl_native/include/rb_gsl_tensor.h
index 35c98c1..9828f9b 100644
--- ext/gsl_native/include/rb_gsl_tensor.h
+++ ext/gsl_native/include/rb_gsl_tensor.h
@@ -5,7 +5,7 @@
 #include "rb_gsl.h"
 #include <tensor/tensor.h>
 
-EXTERN VALUE cgsl_tensor, cgsl_tensor_int;
+extern VALUE cgsl_tensor, cgsl_tensor_int;
 
 enum {
   TENSOR_ADD,
diff --git ext/gsl_native/include/templates_off.h ext/gsl_native/include/templates_off.h
index 37e024d..db01c79 100644
--- ext/gsl_native/include/templates_off.h
+++ ext/gsl_native/include/templates_off.h
@@ -85,3 +85,8 @@
 #undef NAME
 #undef STRING
 #undef EXPAND
+
+#ifdef RUBY_3
+#undef memcpy
+#define memcpy ruby_nonempty_memcpy
+#endif
\ No newline at end of file
diff --git ext/gsl_native/include/templates_on.h ext/gsl_native/include/templates_on.h
index 4db23e9..44520d1 100644
--- ext/gsl_native/include/templates_on.h
+++ ext/gsl_native/include/templates_on.h
@@ -239,3 +239,9 @@
 #define STRING(x) #x
 #define EXPAND(x) STRING(x)
 #define NAME(x) EXPAND(GSL_TYPE(x))
+
+// Ruby 3 redefines memcpy as ruby_nonempty_memcpy, breaking everything if memcpy is used in preprocessor
+#ifdef RUBY_3
+#undef memcpy
+#define memcpy memcpy
+#endif
\ No newline at end of file
diff --git ext/gsl_native/interp.c ext/gsl_native/interp.c
index 366f594..4decffc 100644
--- ext/gsl_native/interp.c
+++ ext/gsl_native/interp.c
@@ -12,7 +12,7 @@
 #include "include/rb_gsl_interp.h"
 
 VALUE cgsl_interp_accel; /* this is used also in spline.c */
-EXTERN VALUE cgsl_vector, cgsl_matrix;
+extern VALUE cgsl_vector, cgsl_matrix;
 
 static void rb_gsl_interp_free(rb_gsl_interp *sp);
 
diff --git ext/gsl_native/interp2d.c ext/gsl_native/interp2d.c
index e086eab..ec23067 100644
--- ext/gsl_native/interp2d.c
+++ ext/gsl_native/interp2d.c
@@ -12,7 +12,7 @@
 #include "include/rb_gsl_interp2d.h"
 
 VALUE cgsl_interp2d_accel; /* this is used also in spline2d.c */
-EXTERN VALUE cgsl_vector, cgsl_matrix;
+extern VALUE cgsl_vector, cgsl_matrix;
 
 static VALUE rb_gsl_interp2d_alloc(int argc, VALUE *argv, VALUE self)
 { 
diff --git ext/gsl_native/linalg_complex.c ext/gsl_native/linalg_complex.c
index 491ad0c..4ee62fa 100644
--- ext/gsl_native/linalg_complex.c
+++ ext/gsl_native/linalg_complex.c
@@ -14,8 +14,8 @@
 #include "include/rb_gsl_common.h"
 #include "include/rb_gsl_linalg.h"
 
-EXTERN VALUE mgsl_linalg;
-EXTERN VALUE cgsl_complex;
+extern VALUE mgsl_linalg;
+extern VALUE cgsl_complex;
 
 static VALUE cgsl_matrix_complex_LU;
 static VALUE cgsl_matrix_complex_C;
diff --git ext/gsl_native/matrix_source.h ext/gsl_native/matrix_source.h
index d6f312b..cef5a9a 100644
--- ext/gsl_native/matrix_source.h
+++ ext/gsl_native/matrix_source.h
@@ -1536,7 +1536,7 @@ static int FUNCTION(mygsl_matrix,equal)(GSL_TYPE(gsl_matrix) *a, GSL_TYPE(gsl_ma
 }
 
 #ifdef HAVE_TENSOR_TENSOR_H
-EXTERN VALUE cgsl_tensor, cgsl_tensor_int;
+extern VALUE cgsl_tensor, cgsl_tensor_int;
 VALUE rb_gsl_tensor_equal(int argc, VALUE *argv, VALUE obj);
 VALUE rb_gsl_tensor_int_equal(int argc, VALUE *argv, VALUE obj);
 #ifdef BASE_DOUBLE
diff --git ext/gsl_native/monte.c ext/gsl_native/monte.c
index 3559001..8d83bdb 100644
--- ext/gsl_native/monte.c
+++ ext/gsl_native/monte.c
@@ -25,7 +25,7 @@ static VALUE cgsl_monte_miser;
 static VALUE cgsl_monte_vegas;
 static VALUE cgsl_monte_function;
 static VALUE cgsl_monte_miser_params, cgsl_monte_vegas_params;
-EXTERN VALUE cgsl_vector;
+extern VALUE cgsl_vector;
 
 enum {
   GSL_MONTE_PLAIN_STATE = 1,
diff --git ext/gsl_native/root.c ext/gsl_native/root.c
index dfed2c8..666ec81 100644
--- ext/gsl_native/root.c
+++ ext/gsl_native/root.c
@@ -14,7 +14,7 @@
 #include "include/rb_gsl_function.h"
 #include "include/rb_gsl_root.h"
 
-EXTERN VALUE cgsl_function_fdf;
+extern VALUE cgsl_function_fdf;
 
 enum {
   GSL_ROOT_FSOLVER_BISECTION,
diff --git ext/gsl_native/sf_bessel.c ext/gsl_native/sf_bessel.c
index 65d5038..c0ab45d 100644
--- ext/gsl_native/sf_bessel.c
+++ ext/gsl_native/sf_bessel.c
@@ -11,7 +11,7 @@
 */
 
 #include "include/rb_gsl_sf.h"
-EXTERN VALUE cgsl_vector;
+extern VALUE cgsl_vector;
 
 /* Cylindrical Bessel Functions */
 static VALUE rb_gsl_sf_bessel_J0(VALUE obj, VALUE x)
diff --git ext/gsl_native/sf_coulomb.c ext/gsl_native/sf_coulomb.c
index c314642..6479769 100644
--- ext/gsl_native/sf_coulomb.c
+++ ext/gsl_native/sf_coulomb.c
@@ -11,7 +11,7 @@
 */
 
 #include "include/rb_gsl_sf.h"
-EXTERN VALUE cgsl_vector;
+extern VALUE cgsl_vector;
 
 static VALUE rb_gsl_sf_hydrogenicR_1(VALUE obj, VALUE Z, VALUE r)
 {
diff --git ext/gsl_native/sf_legendre.c ext/gsl_native/sf_legendre.c
index 5a9470e..91836e1 100644
--- ext/gsl_native/sf_legendre.c
+++ ext/gsl_native/sf_legendre.c
@@ -10,7 +10,7 @@
 */
 
 #include "include/rb_gsl_sf.h"
-EXTERN VALUE cgsl_vector;
+extern VALUE cgsl_vector;
 
 static VALUE rb_gsl_sf_legendre_P1(VALUE obj, VALUE x)
 {
diff --git ext/gsl_native/sort.c ext/gsl_native/sort.c
index a1acd78..240a8fb 100644
--- ext/gsl_native/sort.c
+++ ext/gsl_native/sort.c
@@ -13,8 +13,8 @@
 #include <gsl/gsl_heapsort.h>
 #include <gsl/gsl_sort.h>
 
-EXTERN ID RBGSL_ID_call;
-EXTERN VALUE cgsl_complex;
+extern ID RBGSL_ID_call;
+extern VALUE cgsl_complex;
 
 int rb_gsl_comparison_double(const void *aa, const void *bb);
 int rb_gsl_comparison_complex(const void *aa, const void *bb);
diff --git ext/gsl_native/spline.c ext/gsl_native/spline.c
index dd42355..0d730da 100644
--- ext/gsl_native/spline.c
+++ ext/gsl_native/spline.c
@@ -11,7 +11,7 @@
 
 #include "include/rb_gsl_interp.h"
 
-EXTERN VALUE cgsl_interp_accel;  /* defined in interp.c */
+extern VALUE cgsl_interp_accel;  /* defined in interp.c */
 
 static void rb_gsl_spline_free(rb_gsl_spline *sp);
 
diff --git ext/gsl_native/spline2d.c ext/gsl_native/spline2d.c
index 34e0c2b..36f3106 100644
--- ext/gsl_native/spline2d.c
+++ ext/gsl_native/spline2d.c
@@ -11,7 +11,7 @@
 #ifdef GSL_2_0_LATER
 #include "include/rb_gsl_interp2d.h"
 
-EXTERN VALUE cgsl_interp2d_accel;  /* defined in interp2d.c */
+extern VALUE cgsl_interp2d_accel;  /* defined in interp2d.c */
 static void rb_gsl_spline2d_free(rb_gsl_spline2d *fr);
 
 static VALUE rb_gsl_spline2d_alloc(int argc, VALUE *argv, VALUE self)
diff --git ext/gsl_native/vector_complex.c ext/gsl_native/vector_complex.c
index b598746..83db5ee 100644
--- ext/gsl_native/vector_complex.c
+++ ext/gsl_native/vector_complex.c
@@ -12,7 +12,7 @@
 #include "include/rb_gsl_array.h"
 #include "include/rb_gsl_complex.h"
 
-EXTERN VALUE cgsl_complex;
+extern VALUE cgsl_complex;
 static VALUE rb_gsl_vector_complex_inner_product(int argc, VALUE *argv, VALUE obj);
 static VALUE rb_gsl_vector_complex_product_to_m(int argc, VALUE *argv, VALUE obj);
 
diff --git ext/gsl_native/vector_source.h ext/gsl_native/vector_source.h
index 1d343cd..2b265d9 100644
--- ext/gsl_native/vector_source.h
+++ ext/gsl_native/vector_source.h
@@ -687,7 +687,7 @@ static VALUE FUNCTION(rb_gsl_vector,uplus)(VALUE obj)
   return obj;
 }
 
-EXTERN VALUE cgsl_poly;
+extern VALUE cgsl_poly;
 
 VALUE FUNCTION(rb_gsl_vector,uminus)(VALUE obj)
 {
@@ -1009,7 +1009,7 @@ int FUNCTION(rbgsl_vector,equal)(const GSL_TYPE(gsl_vector) *v1, const GSL_TYPE(
 }
 
 #ifdef HAVE_TENSOR_TENSOR_H
-EXTERN VALUE cgsl_tensor, cgsl_tensor_int;
+extern VALUE cgsl_tensor, cgsl_tensor_int;
 VALUE rb_gsl_tensor_equal(int argc, VALUE *argv, VALUE obj);
 VALUE rb_gsl_tensor_int_equal(int argc, VALUE *argv, VALUE obj);
 #ifdef BASE_DOUBLE