Archive: StrFunc question


StrFunc question
The string manipulation functions in StrFunc.nsh must be "declared" before they are used:


!include "StrFunc.nsh"
${StrTok}
... go on to use ${StrTok}

That's all well and good, but I use these functions in a bunch of other .nsh files and at the moment have to place the declaration in the main .nsi file. Otherwise I get compilation errors.

All very understandable, but is their a way to protect the declaration above so that my .nsh files can be self-contained?

I imagine some


!ifndef foo
${StrTok}
!endif


but have been unable to figure out exactly what.

Angus

!ifndef StrTok
${StrTok}
!endif

this should do the trick :)

Unfortunately not:

!insertmacro: macro "FUNCTION_STRING_StrTok" requires 0 parameter(s), passed 5!
!include: error in script: "search_registry.nsh" on line 437
Error in script "software_audit.nsi" on line 48 -- aborting creation process

I think that the reason is that StrTok is already defined but that ${StrTok} *redefines* it.