Here's a conceptual example using Windows API to inject a DLL, which then executes code:
var InputCode, ConvertedCode: string;
Depending on whether you need to convert a raw code for an ECU or simply program it, several tools are industry leaders: delphi injector code converter top
Delphi Injection Migrator (DIM) for complex projects. WPH for quick WinAPI fix-ups. Here's a conceptual example using Windows API to