Archive: Want to embed function from another script


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. :cry:

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?


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.)


Originally posted by MSG
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

Originally posted by Afrow UK
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."