// Startup and unload routines for initialization and cleanup, see: `R/zzz.R`

#include <Rcpp.h>

#include "SchachHoernchen/search.h"

// [[Rcpp::export(".onLoad")]]
void onLoad(const std::string& libname, const std::string& pkgname) {
    // Initialize search (Transposition Table)
    Search::init();
    // Report search initialization
    Rcpp::Rcout << "info string search initialized" << std::endl;
}

// [[Rcpp::export(".onUnload")]]
void onUnload(const std::string& libpath) {
    // Cleanup any outstanding or running/finished worker tasks
    Search::stop();
    // Report shutdown (stopping any remaining searches)
    Rcpp::Rcout << "info string shutdown" << std::endl;
}
