[R] Avoid symbol naming conflicts with other packages (#7245)

* don't register all R symbols

* typo
This commit is contained in:
david-cortes 2021-09-19 21:17:08 +03:00 committed by GitHub
parent e48e05e6e2
commit 61a619b5c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -17,7 +17,7 @@ endif
$(foreach v, $(XGB_RFLAGS), $(warning $(v))) $(foreach v, $(XGB_RFLAGS), $(warning $(v)))
PKG_CPPFLAGS= -I$(PKGROOT)/include -I$(PKGROOT)/dmlc-core/include -I$(PKGROOT)/rabit/include -I$(PKGROOT) $(XGB_RFLAGS) PKG_CPPFLAGS= -I$(PKGROOT)/include -I$(PKGROOT)/dmlc-core/include -I$(PKGROOT)/rabit/include -I$(PKGROOT) $(XGB_RFLAGS)
PKG_CXXFLAGS= @OPENMP_CXXFLAGS@ @ENDIAN_FLAG@ -pthread PKG_CXXFLAGS= @OPENMP_CXXFLAGS@ @ENDIAN_FLAG@ -pthread $(CXX_VISIBILITY)
PKG_LIBS = @OPENMP_CXXFLAGS@ @OPENMP_LIB@ @ENDIAN_FLAG@ @BACKTRACE_LIB@ -pthread PKG_LIBS = @OPENMP_CXXFLAGS@ @OPENMP_LIB@ @ENDIAN_FLAG@ @BACKTRACE_LIB@ -pthread
OBJECTS= ./xgboost_R.o ./xgboost_custom.o ./xgboost_assert.o ./init.o \ OBJECTS= ./xgboost_R.o ./xgboost_custom.o ./xgboost_assert.o ./init.o \
$(PKGROOT)/amalgamation/xgboost-all0.o $(PKGROOT)/amalgamation/dmlc-minimum0.o \ $(PKGROOT)/amalgamation/xgboost-all0.o $(PKGROOT)/amalgamation/dmlc-minimum0.o \

View File

@ -9,6 +9,7 @@
#include <Rinternals.h> #include <Rinternals.h>
#include <stdlib.h> #include <stdlib.h>
#include <R_ext/Rdynload.h> #include <R_ext/Rdynload.h>
#include <R_ext/Visibility.h>
/* FIXME: /* FIXME:
Check these declarations against the C/Fortran source code. Check these declarations against the C/Fortran source code.
@ -89,7 +90,7 @@ static const R_CallMethodDef CallEntries[] = {
#if defined(_WIN32) #if defined(_WIN32)
__declspec(dllexport) __declspec(dllexport)
#endif // defined(_WIN32) #endif // defined(_WIN32)
void R_init_xgboost(DllInfo *dll) { void attribute_visible R_init_xgboost(DllInfo *dll) {
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL); R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
R_useDynamicSymbols(dll, FALSE); R_useDynamicSymbols(dll, FALSE);
} }

View File

@ -0,0 +1,3 @@
LIBRARY xgboost.dll
EXPORTS
R_init_xgboost