Recent

Author Topic: Convert unit from Delphi  (Read 1016 times)

@Func

  • New Member
  • *
  • Posts: 36
Convert unit from Delphi
« on: January 06, 2020, 03:27:28 am »
I ues a 3dpart component in delphi , now i need to convert some code from delphi to lazarus.
In delphi there has this code ,It could not work in lazarus.

    C := AnsiStrIComp(PChar( TJvInterpreterIdentifier(List).Identifier), PChar(Identifier));   

so I change to this way

    C := AnsiStrIComp(PChar( TJvInterpreterIdentifier(@List).Identifier), PChar(Identifier));   
it can complie now , but when run to this code , application will crashed.

thanks a lot

jamie

  • Hero Member
  • *****
  • Posts: 7413
Re: Convert unit from Delphi
« Reply #1 on: January 06, 2020, 04:04:33 am »
Code: Pascal  [Select][+][-]
  1.  
  2.     C := AnsiStrIComp(PChar( TJvInterpreterIdentifier(List).Identifier), PChar(Identifier));    
  3.  
  4. ///so I change to this way
  5.  
  6.     C := AnsiStrIComp(PChar( TJvInterpreterIdentifier(@List).Identifier), PChar(Identifier));    
  7. ///it can complie now , but when run to this code , application will crashed.
  8.  
  9.  

It's my guess and only a guess that LIST is a pointer to an array of objects or classes or records etc..

 (List)^……
may work

 or go to the top of the unit file and use {$mode Delphi} instead of objfpc

that may help you.


The only true wisdom is knowing you know nothing

@Func

  • New Member
  • *
  • Posts: 36
Re: Convert unit from Delphi
« Reply #2 on: January 06, 2020, 04:09:00 am »
Code: Pascal  [Select][+][-]
  1.  
  2.     C := AnsiStrIComp(PChar( TJvInterpreterIdentifier(List).Identifier), PChar(Identifier));    
  3.  
  4. ///so I change to this way
  5.  
  6.     C := AnsiStrIComp(PChar( TJvInterpreterIdentifier(@List).Identifier), PChar(Identifier));    
  7. ///it can complie now , but when run to this code , application will crashed.
  8.  
  9.  

It's my guess and only a guess that LIST is a pointer to an array of objects or classes or records etc..

 (List)^……
may work

 or go to the top of the unit file and use {$mode Delphi} instead of objfpc

that may help you.




Yes ,you are right ,thanks a lot

 

TinyPortal © 2005-2018