Open panovr opened 4 years ago
Hi yes this is still a huge WIP, as can be seen by the lack of documentation and issues filled
This is one of the examples I use for testing
#define convention __stdcall
struct Foo
{
int a;
Foo(int b) : a(b) { }
void convention print(std::vector<char> b) const noexcept
{
std::cout << b.data() << ' ' << a << std::endl;
}
};
using some_proc = void(convention*)(std::size_t, std::vector<char>) noexcept;
int main()
{
Foo test(1337);
auto thunk = member_thunk::make<some_proc>(&test, &Foo::print);
thunk->get_thunked_function()(0xdeaddead, {'h', 'e', 'l', 'l', 'o', '\0'});
}
You can also see more advanced use in the development branch of TranslucentTB, notably in TaskbarAttributeWorker.
Currently, you're also going to want to comment out this code because it always fails with invalid arguments and I haven't figured out why yet https://github.com/sylveon/member_thunk/blob/b30a4b6173e84a601b5926c048a851b64254849d/include/member_thunk/details/base_thunk.hpp#L39-L42
I'll keep this issue open for tracking when I add real examples if you don't mind.
Sure, thanks!
May you add some examples? Thanks!