From b02c083a3545b6e6b36ab62680128edec619a804 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Tue, 15 Apr 2025 14:47:58 +0200 Subject: Fixed function pointer thing --- cpp/examples/solve_h48h3k2.cpp | 6 +----- cpp/nissy.cpp | 5 +---- cpp/nissy.h | 2 +- 3 files changed, 3 insertions(+), 10 deletions(-) (limited to 'cpp') diff --git a/cpp/examples/solve_h48h3k2.cpp b/cpp/examples/solve_h48h3k2.cpp index b747976..454d6dc 100644 --- a/cpp/examples/solve_h48h3k2.cpp +++ b/cpp/examples/solve_h48h3k2.cpp @@ -6,13 +6,9 @@ #include #include -extern "C" { - long long nissy_setlogger(void (*)(const char *)); -} - int main() { // Get verbose output - nissy_setlogger([](const char* s) { std::cout << s; }); + nissy::set_logger([](const char* s) { std::cout << s; }); // Get the scramble from the user std::cout << "Enter scramble: "; diff --git a/cpp/nissy.cpp b/cpp/nissy.cpp index b3bf6c4..2a52ab1 100644 --- a/cpp/nissy.cpp +++ b/cpp/nissy.cpp @@ -227,8 +227,5 @@ namespace nissy { return error{err}; } - void set_logger(const std::function& log) - { - nissy_setlogger(log.target()); - } + void set_logger(void (*log)(const char *)) { nissy_setlogger(log); } } diff --git a/cpp/nissy.h b/cpp/nissy.h index a809528..ff74f12 100644 --- a/cpp/nissy.h +++ b/cpp/nissy.h @@ -100,7 +100,7 @@ namespace nissy { }; error count_moves(const std::string&); - void set_logger(const std::function&); + void set_logger(void (*)(const char*)); } #endif -- cgit v1.3