Full raise syntax:
raise Exception at address
All you have to do is pass the current IP address as a parameter, and proc proc can pass this exception.
You can get RIP with lea rax, [rip] .
Thus, the code becomes:
asm or rcx,rcx jz @error .... @error: mov ecx, 1 mov rdx, ErrorString lea r8,[rip] jmp RaiseError .... function RaiseError(code: integer; const Msg: string; address: pointer); begin case code of 1: raise EEmptyArrayError.Create(Msg) at address;
Of course, in this case itβs easier to use
function RaiseError(code: integer; const Msg: string); begin case code of 1: raise EEmptyArrayError.Create(Msg) at ReturnAddress;
Note
In this case, if you save jmp, the error seems to come from the calling routine, in which case it is really correct. If you want the exception to point to the guilty finger on your asm code, then use the call.
Johan source share