some logger changes

This commit is contained in:
2025-04-12 22:28:16 +03:00
parent 6f3c76b005
commit 1a10f79b02
9 changed files with 110 additions and 146 deletions

View File

@@ -2,24 +2,27 @@
#include "../../include/hiload/hiload.h"
#include <assert.h>
#include <chrono>
#include <cstdio>
#include <thread>
#define ARRLEN(A) (sizeof((A)) / (sizeof((A)[0])))
int main(int argc, char *argv[]) {
const char *reloadable_modules[] = {"", "libmini.so"};
hi_init(2, reloadable_modules);
hi_init(ARRLEN(reloadable_modules), reloadable_modules);
int modified = -1;
while (modified != 0) {
printf("==========================\n");
printf("main address: %p\n", main);
printf("minimal_lib::getNewValue address: %p\n", minimal_lib::getNewValue);
printf("minimal_lib::otherValue address: %p\n", &minimal_lib::otherValue);
printf("==========================\n");
printf("");
// printf("==========================\n");
// printf("main address: %p\n", main);
// printf("minimal_lib::getNewValue address: %p\n", minimal_lib::getNewValue);
// printf("minimal_lib::otherValue address: %p\n", &minimal_lib::otherValue);
// printf("==========================\n");
// printf("");
modified = minimal_lib::getNewValue(5);
printf("getModified(5): %d\n", modified);
@@ -27,10 +30,9 @@ int main(int argc, char *argv[]) {
printf("otherValue: %d\n", minimal_lib::otherValue++);
std::this_thread::sleep_for(std::chrono::seconds(1));
printf("\n");
if (hi_reload_solib("libmini.so") != HI_RELOAD_SUCCESS) {
fprintf(stderr, "Failed to load solib\n");
if (hi_reload() != HILOAD_OK) {
fprintf(stderr, "Failed to load modules\n");
}
}