Wednesday, July 15, 2009

How to suppress InstallShield warning W7503

If you are like me and don't like duplication you might have something like a common.rul file that contains common methods. But with the InstallShield (7.x and higher ?) compiler you get this warning if you didn't use a method:
W7503: function defined but never called
Bad thing about this is the fact that you can't easily spot real warnings from this 'warning to ignore'.
Here's how to avoid this:
1) define a dummy method where you call all your offending methods
// dummy function to supress warning 'function defined but never called'
prototype dummySuppressWarningW7503();
function dummySuppressWarningW7503()
begin
setRegistryValue("","",0,"");
end;
2) call this method someplace that is definitely executed inside an if( FALSE ):
// a little trick to stop the compiler from showing warnings
if( FALSE ) then
dummySuppressWarningW7503();
endif;
Tada ! The compiler thinks its called, but it never is.

4 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. I found too that a decent way to employ this is with a dummy recursive call at the outset of an InstallScript function, passing its params as-is - for example:

    function Foo(szBar, szBaz)
    begin
    if (FALSE) then
    Foo(szBar, szBaz);
    endif;

    // Moving on....
    end;

    ReplyDelete
  3. Ah, I see. Yes that should work, probably better because you keep your function calls together. Nice.

    ReplyDelete