I have seen many answers about calling an older DLL in D2010 (Unicode), but the problem is that I am doing just the opposite. We are writing new parts of an application (DLLs) in D2010. The parent app is written in D5 and cannot be changed out into a D2010 app for a while (maybe a couple years).
The DLL params and variables can be changed (D2010), but the parent app (D5) cannot be touched. The integer parameters seem to be fine, it is the string/PChar parameters that are not working. For example a file path string of "D:\home\special\files\" looks like '??????????????????' when I evaluate it. I changed the DLL parameters to PAnsiChar, but that didn't seem to help.
If the DLL and a host app are both compiled in the same version of Delphi, it works fine (before I added the Ansi stuff).
Any ideas?
Code sample:
In the host (D5):
fpLoadImage: procedure(sFilename: PChar); stdcall;
.
.
.
@fpLoadImage := GetProcAddress(hLib, 'LoadImage');
In the DLL (D2010):
procedure LoadImage(sFileName: pAnsiChar);
var
TempStr: string;
begin
TempStr := sFileName;
frmViewer.ImageFileName := TempStr;
frmViewer.PCurrentImageId(-2);
end;