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

Return type mismatch


2 replies to this topic

lingold

lingold
  • Members
  • 42 posts

Posted 21 October 2005 - 14:44

Im InstallScript-Bereich eines InstallShield 10.5 Basic MSI Projektes habe ich folgende function definiert und deklariert:
prototype string GiveSomeString();
function GiveSomeString()
string strValue;
begin
strValue = "myValue";
return strValue;
end;
Wenn ich das compilieren will, kommt die Fehlermeldung:
'GiveSomeString' : return type mismatch with prototype (Error code C8115).
Dieser Error Code ist ein Link, und man findet dort folgende Information:
This message occurs when the return type of a script-defined function (the data type of the value returned by the function) is not the same in the function definition as it is in the function declaration.
Das kann ich nicht mehr verstehen. Es handelt sich doch bei meiner Function übereinstimmend um den Typ string. Was ist hier falsch?

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 23 October 2005 - 15:20

Erstmal muss das glaube ich STRING heissen und nicht string.
Ausserdem können InstallScript-Funktionen nur numerische Rückgabewerte liefern, keine Strings. Um einen String zurückzugeben, musst du einen BYREF Parameter verwenden.

lingold

lingold
  • Members
  • 42 posts

Posted 24 October 2005 - 09:18

Danke, das hat geholfen! Zunächst hatte ich allerdings noch immer den Fehler mit dem folgenden Prototype:
prototype void GiveSomeString(BYREF string);
Es stellte sich heraus, dass man das Wort 'void' nicht schreiben darf. Wenn ich 'void' weglasse, ist alles OK. Des weiteren kann ich noch sagen, dass es bei mir funktionierte sowohl mit STRING als auch mit string.