|
|||||||
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 |
|
Senior Member
|
How to call NSIS function from plugin via ExecuteCodeSegment
Hi
I would like to execute my NSIS function TryMe from plugin (.dll). This is my NSIS code: PHP Code:
PHP Code:
What I am doing wrong? Create cool looking Graphical Installers in NSIS: www.graphical-installer.com -see below I offer NSIS scripting, C/C++/C#/Delphi programming: www.unsigned-softworks.sk Develop NSIS projects directly in Visual Studio 2005-2012: www.unsigned-softworks.sk/visual-installer/ |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
|
Needs to be iFunc - 1. I forget why.
Stu Need an installer? http://www.afrowsoft.co.uk |
|
|
|
|
|
#3 |
|
Senior Member
|
These hidden features are killing me!!!!!
Big thanks, now it works fine! Create cool looking Graphical Installers in NSIS: www.graphical-installer.com -see below I offer NSIS scripting, C/C++/C#/Delphi programming: www.unsigned-softworks.sk Develop NSIS projects directly in Visual Studio 2005-2012: www.unsigned-softworks.sk/visual-installer/ |
|
|
|
|
|
#4 |
|
Senior Member
|
I need that code for my new plugin ThreadTimer.
ThreadTimer plug-in allows you to create simple Timer which runs in a separate thread. It is available since Start until Stop, it ticks in desired interval and calls NSIS function. It can be created for a whole life-cycle of installer because it is NOT tied with any installer page or nsDialogs page. See more on it's wiki page: http://nsis.sourceforge.net/ThreadTimer_plug-in Thanks to user bluenet whose Delay plugin gave me some ideas: showthread.php?postid=2350657 Use this topic for questions/comments to this plugin.
Create cool looking Graphical Installers in NSIS: www.graphical-installer.com -see below I offer NSIS scripting, C/C++/C#/Delphi programming: www.unsigned-softworks.sk Develop NSIS projects directly in Visual Studio 2005-2012: www.unsigned-softworks.sk/visual-installer/ |
|
|
|
|
|
#5 |
|
Major Dude
Join Date: Oct 2006
Posts: 1,841
|
It's probably better to start a new thread about this plugin. The topic itself has nothing to do with timer plugins, so people aren't likely to find it easily.
|
|
|
|
|
|
#6 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
|
Your DLL depends on MSVCRT90 which means the installer will crash on systems without it (e.g. machines without .NET 3.5).
http://nsis.sourceforge.net/Building...%29_dependency Stu Need an installer? http://www.afrowsoft.co.uk |
|
|
|
|
|
#7 | |
|
Senior Member
|
Quote:
![]() Also I updated this list with some of my ideas: http://nsis.sourceforge.net/Building...%29_dependency Hope it helps someone, I lost 2 hours with linker errors! Create cool looking Graphical Installers in NSIS: www.graphical-installer.com -see below I offer NSIS scripting, C/C++/C#/Delphi programming: www.unsigned-softworks.sk Develop NSIS projects directly in Visual Studio 2005-2012: www.unsigned-softworks.sk/visual-installer/ |
|
|
|
|
|
|
#8 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
|
By the way in future when you upload files to the Wiki, don't put the version in the file name. You can put the version number as a comment and avoid multiple file names.
Stu Need an installer? http://www.afrowsoft.co.uk |
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Aug 2011
Posts: 4
|
I get this error:
Invalid command: ThreadTimer::Start I am using as from the example: ThreadTimer::Start /NOUNLOAD 2345 8 $2 I have copied the dll to the NSIS/Plugins folder. What else have I missed? Other plugins are working fine. I am using Nsis 2.46 Special Build-Large strings (http://nsis.sourceforge.net/Special_Builds), does it make any difference? |
|
|
|
|
|
#10 |
|
Senior Member
|
@mrmls: Did the example work fine for you? Try to compile it and compare to your script.
Plugin is not dependent on any NSIS version, so using Large strings build is fine. Create cool looking Graphical Installers in NSIS: www.graphical-installer.com -see below I offer NSIS scripting, C/C++/C#/Delphi programming: www.unsigned-softworks.sk Develop NSIS projects directly in Visual Studio 2005-2012: www.unsigned-softworks.sk/visual-installer/ |
|
|
|
|
|
#11 |
|
Junior Member
Join Date: Aug 2011
Posts: 4
|
No, the example does not work, I copied and pasted it in a brand new install script (created by the wizard), but it does not compile. Returns the above message.
When I comment out the line containing ThreadTimer commands, it compiles fine. I'm also on 64-bit OS (Windows 7), maybe this causes some issues. I will try to build the dll from provided source. |
|
|
|
|
|
#12 |
|
Junior Member
Join Date: Aug 2011
Posts: 4
|
Rebuilt the project on my computer, also on x64 configuration. Still the same error:
Invalid command: ThreadTimer::Start I have ensured that I copy ThreadTimer.dll to right "Plugins" folder. |
|
|
|
|
|
#13 |
|
Senior Member
Join Date: Mar 2006
Location: Dallas
Posts: 442
|
It looks to me like the plugin was compiled with the wrong options, the function names are 'decorated' and shouldn't be. Makensisw shows this when I put the release version dll into my plugins folder:
Only the first two lines are from the ThreadTimer dll, the others came from other plugins that were discovered. But you see the difference in the names.code: Don |
|
|
|
|
|
#14 |
|
Junior Member
Join Date: Aug 2011
Posts: 4
|
Indeed, now I looked at that output too.
Thanks a lot! |
|
|
|
|
|
#15 | |
|
Senior Member
|
Quote:
When I analyse dll in DependencyWalker I can see functions correctly too - as C functions. Also I attached picture of .def file I made to have correct exports of these functions. Create cool looking Graphical Installers in NSIS: www.graphical-installer.com -see below I offer NSIS scripting, C/C++/C#/Delphi programming: www.unsigned-softworks.sk Develop NSIS projects directly in Visual Studio 2005-2012: www.unsigned-softworks.sk/visual-installer/ |
|
|
|
|
|
|
#16 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
|
You are using a lot of CRT functions and for that reason you are still linking to it, even though you have disabled the manifest. As you have compiled with VC9 all machines will need .NET 3.5 or standalone MSCRT90 installed, which by no means will always be the case. The installer will crash.
There is no need to use functions such as _beginthreadex and memset and you must not use the new operator. These are all functions/features that use or depend on the CRT. There are Win32 API alternatives such as CreateThread and LocalAlloc/GlobalAlloc (and you do not need to zero the memory if you use the right *Alloc options). Finally your exports are wrong. You are missing extern "C" from your function definitions. Also, if you decorate functions with __declspec(dllexport), you do not need a .def file. If you get your plug-in built without CRT it will be ~4KB rather than 55KB. Stu Need an installer? http://www.afrowsoft.co.uk |
|
|
|
|
|
#17 |
|
Senior Member
|
Thanks for all suggestions!
I have removed all CRT calls and in Properties -> Linker -> Input I used "Ignore All default libraries" so plug-in is now only 4kB big, but I got a lot of linker errors which I solved by adding tlibc library from http://www.codeproject.com/KB/library/tlibc.aspx to solution. New version was uploaded - 1.1 + sources on wiki, enjoy
Create cool looking Graphical Installers in NSIS: www.graphical-installer.com -see below I offer NSIS scripting, C/C++/C#/Delphi programming: www.unsigned-softworks.sk Develop NSIS projects directly in Visual Studio 2005-2012: www.unsigned-softworks.sk/visual-installer/ |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|