KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm getting this error: [DCC Error] JwaStrSafe.pas(2277): E2010 Incompatible types: 'PSTRSAFE_LPWSTR' and 'PSTRSAFE_LPTSTR' The following is the relevant portion of code from JwaStrSafe.pas (from Jedi Api), I'm compiling with the symbol UNICODE defined: type STRSAFE_LPWSTR = PWIDECHAR; PSTRSAFE_LPWSTR = ^STRSAFE_LPWSTR; {$IFDEF UNICODE} STRSAFE_LPTSTR = STRSAFE_LPWSTR; PSTRSAFE_LPTSTR = ^STRSAFE_LPTSTR; {$ELSE} ... {$ENDIF} ... //function declaration function StringCchCopyExW( {__out_ecount(cchDest)}pszDest : STRSAFE_LPWSTR; {__in}cchDest : size_t; {__in}const pszSrc : STRSAFE_LPCWSTR; {__deref_opt_out_ecount(pcchRemaining^)}ppszDestEnd : PSTRSAFE_LPWSTR; {__out_opt}pcchRemaining : PSize_t; {__in}dwFlags : Cardinal) : HRESULT; stdcall; forward; external; ... //var passed to function ppszDestEnd : PSTRSAFE_LPTSTR; ... {$IFDEF UNICODE} result := StringCchCopyExW(pszDest, cchDest, pszSrc, ppszDestEnd, pcchRemaining, dwFlags); {$ELSE} result := StringCchCopyExA(pszDest, cchDest, pszSrc, ppszDestEnd, pcchRemaining, dwFlags); {$ENDIF} I get the error on the call of StringCchCopyExW, on parameter ppszDestEnd. Looking at the type definition I understand that PSTRSAFE_LPTSTR is a pointer type to STRSAFE_LPTSTR which is just an alias of STRSAFE_LPWSTR, why are PSTRSAFE_LPTSTR and PSTRSAFE_LPWSTR incompatible? Solution Thanks to David's explanation I replaced PSTRSAFE_LPTSTR = ^STRSAFE_LPTSTR; with PSTRSAFE_LPTSTR = PSTRSAFE_LPWSTR; now the code compiles without errors. Thanks
Tags (comma-separated)
Save Edits
Cancel