Skip to content
⌘ NSIS Forum Archive

Want to embed function from another script

4 posts

brim4brim#

Want to embed function from another script

I've looked around and can't find an example of what I'm looking for so I suppose I'm doing it wrong. 😢

I want to includ another nsi file using !include.

My other nsi file is simply:

Function <functionname>
FunctionEnd

Which the compiler doesn't like as I get an error on line 1 of the file to be included. Do I need to use some basic includes or something even if this nsi file will just be included in another nsi file?
MSG#
First of all, you cannot include a file from inside a function or a section. Put the !include all the way at the top of your script.
Second, maybe the compiler doesn't like empty functions? Try adding a bogus command there, like StrCmp "" "" 0 1 or whatever.


(Edit: also, next time you're asking about an error, it *might* help if you posted the actual error. You know, so that people on the other end can actually have a clue what you're talking about.)
Afrow UK#
Originally Posted by MSG View Post
First of all, you cannot include a file from inside a function or a section.
Sure you can. Wherever you put the !include is where the contents of that file will go.

What is the error that the compiler shows?

Stu
MSG#
Originally Posted by Afrow UK View Post
Sure you can. Wherever you put the !include is where the contents of that file will go.

What is the error that the compiler shows?

Stu
Err oops. What I meant to say is "you can't include a header file that defines new functions, from inside a function or section."