Delphi Assembly Function Returning a Long String

后端 未结 2 1031
天命终不由人
天命终不由人 2021-01-15 13:26

I am trying to learn inline assembly programming in Delphi, and to this end I have found this article highly helpful.

Now I wish to write an assembly function return

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-15 13:41

    With the excellent aid of A.Bouchez, I managed to correct my own code, employing LStrSetLength:

    function myfunc: AnsiString;
    asm
    
      push eax
    
      // eax = @result
      mov edx, 3
      mov ecx, 1252
      call System.@LStrSetLength
    
      pop eax
    
      mov ecx, [eax]
    
      mov [ecx], 'A'
      mov [ecx] + 1, 'B'
      mov [ecx] + 2, 'C'
    
    end;
    

提交回复
热议问题