1
0
mirror of https://gitea.tendokyu.moe/Dniel97/segatools.git synced 2024-11-27 22:40:48 +01:00
segatools-dniel97/util/dll-bind.h
2021-06-13 11:27:00 -04:00

34 lines
967 B
C

#pragma once
#include <windows.h>
#include <stdlib.h>
struct dll_bind_sym {
/* Symbol name to locate in the source DLL */
const char *sym;
/* Offset where the symbol pointer should be written in the target
structure */
ptrdiff_t off;
};
/*
Bind a list of DLL symbols into a structure that contains function
pointers.
- dest: Pointer to destination structure.
- src: Handle to source DLL.
- syms_pos: Pointer to a (mutable) pointer which points to the start of an
(immutable) table of symbols and structure offsets. This mutable
pointer is advanced until either a symbol fails to bind, in which case
an error is returned, or the end of the table is reached, in which
case success is returned.
- syms_count: Number of entries in the symbol table.
*/
HRESULT dll_bind(
void *dest,
HINSTANCE src,
const struct dll_bind_sym **syms_pos,
size_t syms_count);