cancel
Showing results for 
Search instead for 
Did you mean: 
polatchekm
Pilgrim

Cannot recognize a declared identifier

I am trying to write to a log during my installscript execution. I have started with some primitive functionality and the following is tripping me up. Here is the code

//note nvFileHandle has been decalred as a number datatype, earlier

OpenFileMode (FILE_MODE_APPEND);
// Create a new file and leave it open.
CreateFile (nvFileHandle, LOG_DIR, LOG_FILE) ;
szMsg = "This line was appended by an example InstallShield script.";

// Append the message to the file.
if (WriteLine(nvFileHandle, szMsg) < 0) then
// Report the error.
MessageBox ("WriteLine failed.", SEVERE);
endif;
closefile(nvFileHandle);

All of it works until I get to the closefile(nvFileHandle); Then I get the 8025 error and the following message.

Error C8025. InstallShield 2010 » InstallScript Language Reference. 'text' : undefined identifier. Description. The identifier specified by text has not been declared. Notes. All identifiers in a script must be declared...
(I am using Installshield 2012 even though the message mentions 2010)

The troublesome identifier is declared e3arlier in the script (not within a function, so it should be public) The same identifier works twice before the failure. (I traced this by selectively commeting out until finding the offending line)

Can anybody tell me why the identifier is not recognized after 2 successful uses, And/Or how I can make this work?

Thanks,

Melvyn Polatchek
Labels (1)
Tags (1)
0 Kudos
2 Replies
phill_mn
Pilgrim

Re: Cannot recognize a declared identifier

I assume that you are actually calling CloseFile(). Your code is similar to:
http://helpnet.installshield.com/installshield16helplib/mergedProjects/installshield16langref/Langre...

except that some of the error checking has been removed. I would check the return code for CreateFile to make sure it has returned a valid handle before using it. I have seen situations where a call to release a resource (such as CloseFile on an invalid handle would be) would confuse the memory manager and cause it to report an error on another variable which is not really related to the problem.

Sorry. Not much to work with, so just a guess.
0 Kudos
polatchekm
Pilgrim

Cannot recognize a declared identifier

Thanks, I will check that out. You are correc that I ued the code you mentioned as my model. As long as we are looking at that: What are the identifiers HWND and hMSI? Do they come from Ifx.h ?

//Snippet from the example

#define EXAMPLE_DIR "C:\\"
#define EXAMPLE_FILE "ISExampl.txt"


// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"

export prototype ExFn_CreateFile(HWND);

function ExFn_CreateFile(hMSI)

STRING szTitle, szMsg;

NUMBER nvFileHandle;

begin


// Set the file mode to append.

OpenFileMode (FILE_MODE_APPEND);
0 Kudos