0

I wanted to bring an old Delphi application (built in Borland Delphi 6) up to version 13 of Crystal reports. It had been brought up to version 10.2 before using the steps outlined in the do-it-yourself guide SAP has posted: http://scn.sap.com/docs/DOC-11048

I committed the same changes again, pointing from the 10.2 registry keys to the 13 registry keys and updating the version checks in the VCL. The VCL component now pulls CRPE32.dll successfully from the right location but then fails to find the related Dll files such as pvlocal-1-0.dll and local_fallback-4-0.dll. If I move all the Dlls to the same folder as the application they are found, but I don't know if I want to be packing all 16 dlls and a license file together with the application.

I've narrowed the issue to the LoadLibrary call in the following method. Unfortunately I can't find any information on how to resolve the issue and was hoping the community might know a way to fix it:

     function TCrpeEngine.PELoadCrpeDll(const CrpeLocation: string) : Bool;
var
  s1,s2 : string;
begin
  Result := False;
  s1 := Trim(CrpeLocation);
  CRDEngine := LoadLibrary(PChar(s1));
  {If an error occured, set the flag}
  if (CRDEngine < HINSTANCE_ERROR) then
  begin
    CRDEngine := 0;
    s2 := SysErrorMessage(GetLastError);
    if Trim(s2) = '' then
      s1 := CRD_ERROR_LOADING + Chr(10) + 'Windows Error Number: ' + IntToStr(GetLastError)
    else
      s1 := CRD_ERROR_LOADING + Chr(10) +
        'Windows Error Number: ' + IntToStr(GetLastError) + ' - ' + Trim(s2);
    CRDEngineError(s1);
  end
  else
    Result := True;
end;
Johan
  • 74,508
  • 24
  • 191
  • 319
ChargerIIC
  • 1,620
  • 1
  • 33
  • 47

2 Answers2

2

The problem is that the the CRPE32.dll is loaded but it does not know where the other DLLs are located as they are not in the search path.

You have a few options.

  1. You can call SetDLLDirectory with with the path that you are storing the DLLs in.
  2. Add the directory where the files are located to the system path.
  3. Add the files to a directory already in the search path.
  4. Add the files to your working directory.
Community
  • 1
  • 1
Robert Love
  • 12,447
  • 2
  • 48
  • 80
  • I read your link on SetDLLDirectory. Just to verify the context for that will be application specific-right? I won't be adjusting Window's DLL Directory for other applications. – ChargerIIC Aug 07 '13 at 04:05
  • 1
    Correct it is application specific. – Robert Love Aug 07 '13 at 07:22
  • SetDllDirectory seems like the way forward. Unfortunately the link you gave doesn't give an example that compiles in Delphi 6. I'll keep working on it but at least I have a way forward now. – ChargerIIC Aug 07 '13 at 19:34
  • That did it! The application is adding the requested path to its search parameters and then discarding it after application close. Thank you again for your help. – ChargerIIC Aug 07 '13 at 20:35
-1

You can not use CR version 13 > with Delphi. CR V13 is .NET

I use CR V13 now w/Delphi XE2. You need to write .NET wrapper using C# or Delphi Prism and call It from Delphi.

ZibNimer
  • 9
  • 1
  • The VCL is a wrapper for the Delphi, but Borland stopped updating it for us and left the guide so we could update the code directly ourselves. It calls the library DLL fine, but can't find the linked DLLs. – ChargerIIC Aug 06 '13 at 18:30
  • No no no, You need to do lots of work to make CRPE32.dll compatible with CR13. none exists so far. – ZibNimer Aug 06 '13 at 21:17
  • You didn't read well enough. The poster says *it works if the DLLs are put in the application directory*, which means it obviously **can be used with Delphi**. The question is where to find the DLLs if they are not placed in the application's own directory. – Ken White Aug 06 '13 at 23:20