Earlier, when I had Delphi 7 , a dll was written on it and an application to it was written on it - everything was fine. The string constant was passed to dll.
Now Delphi 10.2, I had to sharpen dll for it.
I had to change the dll call in the application, to
function TRANSMIT_DATAS_DLL(F_Name_current_application: WideString): Integer; stdcall; far; external 'setting.dll'; those. from String to WideString .
Everything is well transmitted if F_Name_current_application is a var .
But I have this parameter const (for example:
const F_Name_current_application = 'Project.exe'
), if I submit it in this form, then the error:
... raised exception class $ C0000005 with message 'access violation at 0x0419a232: write of address 0x004ed6a0'.
Question :
Is it possible to somehow convey a constant, or is it impossible to do without variables?
PS
Well, the same effect, in principle, with an explicit transfer of the string ('TRANSMIT_DATAS_DLL (' Project.exe ');')
string, then in 10.2 it should becomeAnsiString, and notWideStringif I do not confuse anything. BecauseWideStringin 7 and 10.2 versions. If you compile the library and the application in 10.2, then why not just leave a String? - Alekcvpconst F_Name_current_application = 'Project.exe'is a UnicodeString, if the settings are not changed. - MBo