cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
retzcat
Level 6

Functions and .rul

I've created a .rul file (pure installscript installer) which contains 4 functions all involving NT service piece, like finding if a service is running. I've included the .rul name in my main setup.rul and am trying to use one of the functions in the setup.rul file. I keep getting an error that the function is undefined. Not sure what I'm missing...

The .ruls are

    Setup.rul
    StopService.rul
    uninstall.rul


In Setup.rul
#include "StopService.rul"
#include "uninstall.rul"

Trying to call a function:
function StopDerby()
string szServiceName,nvServiceState;
NUMBER nResult;
begin
szServiceName = "sl-derby.exe";
ServiceConnections(szServiceName); //From StopService.rul


end;


Error is Undefined Identifier on ServiceConnections

Any ideas?

Thanks
Labels (1)
0 Kudos
(3) Replies
RobertDickau
Flexera Alumni

As a sanity check, are those #include lines at the top of setup.rul?
0 Kudos
esiemiat
Level 9

Where are the functions prototyped? They need to be declared before they are called in your code.
0 Kudos
TheTraveler
Level 8

Hello,

Esiemiat is correct. Where are your prototypes? The file arrangement and code should look something like this.

In StopService.rul
///////////////////////////////////////////////////////////////////////////////
// StopService.rul //
///////////////////////////////////////////////////////////////////////////////
// Prototype Area //
///////////////////////////////////////
prototype StopDerby();

///////////////////////////////////////////////////////////////////////////////
// StopDerby //
///////////////////////////////////////////////////////////////////////////////
function StopDerby()
string szServiceName,nvServiceState;
NUMBER nResult;
begin
szServiceName = "sl-derby.exe";

ServiceConnections(szServiceName); //From StopService.rul
end;



In Setup.rul
#include "StopService.rul"
#include "uninstall.rul"

function OnFirstUIBefore()
begin

StopDerby();

end;
0 Kudos