The mORMot[1] sources could give you some info.
During runtime, it patches the exe-memory to redirect function calls.
Hard part was to get around the W^X memory protection on some BSD's.

Look at:

procedure PatchCode(Old,New: pointer; Size: integer; Backup: pointer;
inside SynCommons.pas

function TInterfaceFactory.GetMethodsVirtualTable: pointer;
inside mORMot.pas

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to