imxeno / borland_register

A translation layer for calling functions using Borland's register calling convention from cdecl C++ scope and vice versa.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

borland_register logo

borland_register

A translation layer for calling functions using Borland's register calling convention from cdecl C++ scope and vice versa.

Example usage

// Warning: the translator MUST be in scope!
// If it goes out of scope, all proxy functions bound to it will be deallocated
borland_register::translator brt;

// Generating a proxy for an exported function compiled with Delphi 7 Personal

HMODULE hModule = LoadLibrary("Example.dll");
FARPROC farProc = GetProcAddress(hModule, "FunctionName");

typedef uint32_t(*delphi_function_3)(uint32_t, uint32_t, uint32_t);
delphi_function_3 func = (delphi_function_3)brt.cdecl_to_register(farProc, 3);

// Calling the proxy is as simple as
func(1, 2, 3);

// You can also generate a proxy that will translate it
// the other way using translator::register_to_cdecl

Credits

About

A translation layer for calling functions using Borland's register calling convention from cdecl C++ scope and vice versa.

License:GNU General Public License v3.0


Languages

Language:C++ 81.1%Language:CMake 18.9%