zengine_test/engine/modules/zlib/include/zlib.h

38 lines
973 B
C
Raw Normal View History

2024-08-01 22:22:01 +08:00
#pragma once
#include <iostream>
#include <vector>
#include "zlog.h"
struct Detail {
int count = 0;
int new_count = 0;
int del_count = 0;
2024-08-03 09:44:59 +08:00
Detail() {
std::cout << "Detail" << std::endl;
}
2024-08-01 22:22:01 +08:00
};
struct Module;
2024-08-01 23:45:44 +08:00
ZLIB_API inline Detail detail;
ZLIB_API inline std::vector<Module*>* pModuleList;
2024-08-01 22:22:01 +08:00
struct Module {
std::string name;
bool kind;
void* mHandle{nullptr};
bool Load(std::string path = "");
void* GetSymbol(const char* name);
Module(std::string name, bool kind):kind(kind), name(name){
detail.count++;
if (!pModuleList) {
pModuleList = new std::vector<Module*>;
}
2024-08-02 22:14:00 +08:00
auto ptr = this;
2024-08-01 22:22:01 +08:00
pModuleList->push_back(this);
std::string kind_str = kind ? std::string("shared") : std::string("static");
std::cout << detail.count << ":" << uintptr_t(&zlog::zlog) << "::" << name << ":" << kind_str << std::endl;
}
};
const char* zlib();
#ifdef ZLIB_API_VAL
ZLIB_API inline Module zlib_module{ zlib(), false };
#else
ZLIB_API extern Module zlib_module;
#endif