Avoid including c_api.h in header files. (#5782)
This commit is contained in:
@@ -38,16 +38,16 @@ XGB_DLL void XGBoostVersion(int* major, int* minor, int* patch) {
|
||||
}
|
||||
}
|
||||
|
||||
int XGBRegisterLogCallback(void (*callback)(const char*)) {
|
||||
XGB_DLL int XGBRegisterLogCallback(void (*callback)(const char*)) {
|
||||
API_BEGIN();
|
||||
LogCallbackRegistry* registry = LogCallbackRegistryStore::Get();
|
||||
registry->Register(callback);
|
||||
API_END();
|
||||
}
|
||||
|
||||
int XGDMatrixCreateFromFile(const char *fname,
|
||||
int silent,
|
||||
DMatrixHandle *out) {
|
||||
XGB_DLL int XGDMatrixCreateFromFile(const char *fname,
|
||||
int silent,
|
||||
DMatrixHandle *out) {
|
||||
API_BEGIN();
|
||||
bool load_row_split = false;
|
||||
if (rabit::IsDistributed()) {
|
||||
@@ -60,7 +60,7 @@ int XGDMatrixCreateFromFile(const char *fname,
|
||||
}
|
||||
|
||||
XGB_DLL int XGDMatrixCreateFromDataIter(
|
||||
void *data_handle, // a Java interator
|
||||
void *data_handle, // a Java iterator
|
||||
XGBCallbackDataIterNext *callback, // C++ callback defined in xgboost4j.cpp
|
||||
const char *cache_info, DMatrixHandle *out) {
|
||||
API_BEGIN();
|
||||
@@ -69,7 +69,8 @@ XGB_DLL int XGDMatrixCreateFromDataIter(
|
||||
if (cache_info != nullptr) {
|
||||
scache = cache_info;
|
||||
}
|
||||
xgboost::data::IteratorAdapter adapter(data_handle, callback);
|
||||
xgboost::data::IteratorAdapter<DataIterHandle, XGBCallbackDataIterNext,
|
||||
XGBoostBatchCSR> adapter(data_handle, callback);
|
||||
*out = new std::shared_ptr<DMatrix> {
|
||||
DMatrix::Create(
|
||||
&adapter, std::numeric_limits<float>::quiet_NaN(),
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* \brief C error handling
|
||||
*/
|
||||
#include <dmlc/thread_local.h>
|
||||
#include "xgboost/c_api.h"
|
||||
#include "./c_api_error.h"
|
||||
|
||||
struct XGBAPIErrorEntry {
|
||||
@@ -12,7 +13,7 @@ struct XGBAPIErrorEntry {
|
||||
|
||||
using XGBAPIErrorStore = dmlc::ThreadLocalStore<XGBAPIErrorEntry>;
|
||||
|
||||
const char *XGBGetLastError() {
|
||||
XGB_DLL const char *XGBGetLastError() {
|
||||
return XGBAPIErrorStore::Get()->last_error.c_str();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#include <dmlc/base.h>
|
||||
#include <dmlc/logging.h>
|
||||
#include <xgboost/c_api.h>
|
||||
|
||||
/*! \brief macro to guard beginning and end section of all functions */
|
||||
#define API_BEGIN() try {
|
||||
|
||||
Reference in New Issue
Block a user