How to resolve Delphi error: Incompatible types: 'PWideChar' and 'Pointer' -


i have piece of code delphi 7:

var   lprgndata: prgndata;   pc: pchar;     pr: prect;   ...    pc := @(lprgndata^.buffer[0]); 

in delphi xe4 gives following compile error:

incompatible types: 'pwidechar' , 'pointer' 

how should code updated work correctly in xe4?

thanks

whether or not compiles depends upon setting of type-checked pointers option. have enabled option excellent decision. doing results in stricter type checking.

with type-checked pointers disabled, code compile. type-checked pointers enabled, code not compile, want because code not valid.

now, on types in question. defined in windows unit this:

type   prgndata = ^trgndata;   {$externalsym _rgndata}   _rgndata = record     rdh: trgndataheader;     buffer: array[0..0] of byte;     reserved: array[0..2] of byte;   end;   trgndata = _rgndata;   {$externalsym rgndata}   rgndata = _rgndata; 

the benefit of using type-checked pointers compiler can tell doing not valid. knows lprgndata^.buffer[0] has type byte , @(lprgndata^.buffer[0]) has type ^byte. , knows not compatible pchar alias pwidechar, ^widechar.

fix code changing type of pc ^byte or pbyte.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -