zengine_test/engine/modules/zlib/include/zlib.h
2024-08-01 22:22:01 +08:00

34 lines
887 B
C++

#pragma once
#include <iostream>
#include <vector>
#include "zlog.h"
struct Detail {
int count = 0;
int new_count = 0;
int del_count = 0;
};
struct Module;
inline Detail detail{};
inline std::vector<Module*>* pModuleList{};
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*>;
}
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