FWIW, AutoHotkey.dll is what I've been using for at least one earlier Qatapult plugin -- the Calculate one.
For reference, below is a bit from Calculate.ahk:
; XXX: ScriptText should have #Persistent and a function def
; Pass the script's text using ScriptText
; Pass the name of the function in using FuncName
RunFuncInScriptWithInputText(ScriptText, FuncName, InputText)
{
; XXX: before didn't need to muck with path...
AhkDll
:= AhkDllThread
(A_ScriptDir . "\..\AHK\AutoHotkey.dll") ;OutputDebug, % "Script content: " . ScriptText
AhkDll.ahkTextDll(ScriptText)
Result := AhkDll.ahkFunction(FuncName, InputText)
AhkDll.Terminate()
Return Result
}
Calculate(InputText)
{
FuncName := "Calculate"
ScriptText := "#Persistent`n`n"
. "#NoTrayIcon`n`n"
. FuncName . "()`n"
. "{`n"
. " Result := " . InputText . "`n"
. " Return % Result . A_Space`n" ; XXX: convert to string
. "}`n"
Result := RunFuncInScriptWithInputText(ScriptText, FuncName, InputText)
Result := RTrim(Result)
; XXX: consider whether to modify trailing zeros
Return Result
}
AutoHotkey.dll aside
AutoHotkey.dll has some nice features and the developer (HotKeyIt) is usually pretty responsive about bug reports, but docs for his things are not always up-to-date.