Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

String-Parameter to Delphi-DLL


2 replies to this topic

SubDir

SubDir
  • Members
  • 19 posts

Posted 09 August 2002 - 16:38

In my installShield-programm I call a delphi-dll with a string-parameter, but I get an error.
How must I hand over this string from installshield to the delphi-dll?

jkames

jkames
  • Members
  • 8 posts

Posted 15 August 2002 - 17:32

In InstallShield script you would have something like this:

prototype INT SierraInstall._FormGetInstallationID
               (POINTER,  // _lpszInstallID: PChar;
                POINTER,  // _lpszInstallShareName: PChar;
                POINTER,  // _lpszTargetDir: PChar;
                POINTER,  // _lpszInstallationType: PChar;
                POINTER,  // _lpszCustomInstallationType: PChar;
                POINTER); // _lpszCDVersion: PChar): integer;

code section:
nResult = SierraInstall._FormGetInstallationID
           (&svInstallationID,
            &svInstallationShareName,
            &svDir,
            &szInstallationType,  
            &szCustomInstType,
            &szCDVersion);  

Inside your Delphi DLL specify the DLL as:


function _FormGetInstallationID
          (_lpszInstallID              : PChar;
           _lpszInstallShareName       : PChar;
           _lpszTargetDir              : PChar;
           _lpszInstallationType       : PChar;
           _lpszCustomInstallationType : PChar;
           _lpszCDVersion              : PChar): Integer; stdcall;

You also need to export your function calls in the project file:

exports
 _FormGetInstallationID           name '_FormGetInstallationID';

Hope this helps.
John Ames
InstallShield Developer/Configuration Management Specialist

SubDir

SubDir
  • Members
  • 19 posts

Posted 16 August 2002 - 12:35

Thanks for your answer.

What about the solution that I declare in InstallShield a String-Parameter and the DLL expects pChar?
Can I use this also?
At the moment, it works.