feat: added exports

This commit is contained in:
2025-11-18 21:20:04 +01:00
parent a7faf91b28
commit da6614cb6f
3 changed files with 147 additions and 0 deletions

12
src/detail/exports.hpp Normal file
View File

@@ -0,0 +1,12 @@
#pragma once
#include <cstdint>
#include <fxn/context.hpp>
extern "C"
{
typedef bool (*native_hook_t)(fxn::NativeContext* context, bool& call_original);
__declspec(dllexport) void* fxn_native_invoker_get_handler(std::uint64_t hash);
__declspec(dllexport) void fxn_schedule_native(fxn::NativeContext* context, bool wait);
__declspec(dllexport) void fxn_register_native_hook(std::uint64_t hash, native_hook_t hook);
}

29
src/impl/exports.cpp Normal file
View File

@@ -0,0 +1,29 @@
#include <detail/exports.hpp>
#include <detail/fxn.hpp>
extern "C"
{
__declspec(dllexport) void* fxn_native_invoker_get_handler(std::uint64_t hash)
{
static auto& manager = fxn::FxnManager::GetInstance();
return manager.GetNativeHandler(hash);
}
__declspec(dllexport) void fxn_schedule_native(fxn::NativeContext* context, bool wait)
{
static auto& manager = fxn::FxnManager::GetInstance();
manager.Schedule(context, wait);
}
__declspec(dllexport) void fxn_register_native_hook(std::uint64_t hash, native_hook_t hook)
{
static auto& manager = fxn::FxnManager::GetInstance();
manager.RegisterNativeHook(hash, [hook](fxn::NativeContext* context, bool& call_original)
{
return hook(context, call_original);
});
}
}