Skip to content

Commit

Permalink
Fix compilation problems with R version < 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
melff committed Dec 19, 2017
1 parent 8c95b1a commit 14fad4d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
5 changes: 4 additions & 1 deletion pkg/inst/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
2017-12-19:
- Fix compilation problems with R version < 3.4

2017-12-11:
- Made bracket subsetting of mtable results safer and more coherent.

Expand All @@ -7,7 +10,7 @@
2017-12-01:
- Set a more sensible default for optional argument "show.eqnames" and
global option "mtable.show.eqnames".

2017-11-19:
- Fixed obscure bug affecting import of spss system files under 32bit Windows.
This bug was caused by excessive optimisation of for loops by the C compiler.
Expand Down
11 changes: 10 additions & 1 deletion pkg/src/init-memisc.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
#include "memisc.h"
#include <R_ext/Visibility.h>
#include <Rversion.h>

#if R_VERSION >= R_Version(3,4,0)
#include <R_ext/Visibility.h>
#include <R_ext/Rdynload.h>
void attribute_visible R_init_memisc(DllInfo *dll)
{
R_registerRoutines(dll, NULL, CallMethods, NULL, NULL);
R_useDynamicSymbols(dll, FALSE);

}
#else
#include <R_ext/Rdynload.h>
void R_init_memisc(DllInfo *dll)
{
R_registerRoutines(dll, NULL, CallMethods, NULL, NULL);
R_useDynamicSymbols(dll, FALSE);

}
#endif
3 changes: 1 addition & 2 deletions pkg/src/memisc.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <stdio.h>
#include <Rinternals.h>
#include <Rversion.h>
#include <R_ext/Rdynload.h>

FILE *get_FILE(SEXP);
void trim (char *, int);
Expand Down Expand Up @@ -93,7 +94,6 @@ SEXP dta_skip_records(SEXP s_dta_file, SEXP s_n);
SEXP ord_union(SEXP x, SEXP y);


#if R_VERSION >= R_Version(3,4,0)
static const R_CallMethodDef CallMethods[] = {
{"NewSysFile", (DL_FUNC) &NewSysFile, 1},
{"rewind_sysfile", (DL_FUNC) &rewind_sysfile, 1},
Expand Down Expand Up @@ -158,4 +158,3 @@ static const R_CallMethodDef CallMethods[] = {
{"ord_union", (DL_FUNC) &ord_union, 2},
{NULL, NULL, 0}
};
#endif

0 comments on commit 14fad4d

Please sign in to comment.