<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://nsis.sourceforge.io/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Sharing_functions_between_Installer_and_Uninstaller</id>
	<title>Sharing functions between Installer and Uninstaller - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://nsis.sourceforge.io/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Sharing_functions_between_Installer_and_Uninstaller"/>
	<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Sharing_functions_between_Installer_and_Uninstaller&amp;action=history"/>
	<updated>2026-04-11T05:02:16Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.17</generator>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=Sharing_functions_between_Installer_and_Uninstaller&amp;diff=10531&amp;oldid=prev</id>
		<title>JasonFriday13 at 00:55, 22 May 2006</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=Sharing_functions_between_Installer_and_Uninstaller&amp;diff=10531&amp;oldid=prev"/>
		<updated>2006-05-22T00:55:08Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{PageAuthor|JasonFriday13}}&lt;br /&gt;
== Description ==&lt;br /&gt;
Don Tommaso wrote in [http://forums.winamp.com/showthread.php?s=&amp;amp;threadid=246505 this thread] that he didn&amp;#039;t want to write out his functions for both the installer and uninstaller. So here is an example that makes it easier (and quicker) to share functions between installer and uninstaller.&lt;br /&gt;
&amp;lt;br&amp;gt;Thanks to kichik for the example code.&lt;br /&gt;
== Code Example ==&lt;br /&gt;
The original code by kichik:&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!macro myfunc un&lt;br /&gt;
Function ${un}myfunc&lt;br /&gt;
  Call ${un}someotherfunc&lt;br /&gt;
  DetailPrint something&lt;br /&gt;
FunctionEnd&lt;br /&gt;
!macroend&lt;br /&gt;
&lt;br /&gt;
!insertmacro myfunc &amp;quot;&amp;quot;&lt;br /&gt;
!insertmacro myfunc &amp;quot;un.&amp;quot;&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
And an example script:&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
; Name of our installer.&lt;br /&gt;
Name &amp;quot;Function Sharing Example&amp;quot;&lt;br /&gt;
OutFile &amp;quot;FunctionShareExample.exe&amp;quot;&lt;br /&gt;
InstallDir &amp;quot;$PROGRAMFILES\Function Sharing Example\&amp;quot;&lt;br /&gt;
&lt;br /&gt;
; We need some pages.&lt;br /&gt;
Page directory&lt;br /&gt;
Page instfiles&lt;br /&gt;
; And uninstaller pages.&lt;br /&gt;
UninstPage uninstconfirm&lt;br /&gt;
UninstPage instfiles&lt;br /&gt;
&lt;br /&gt;
; Show the details.&lt;br /&gt;
ShowInstDetails show&lt;br /&gt;
ShowUninstDetails show&lt;br /&gt;
&lt;br /&gt;
; Create the shared function.&lt;br /&gt;
!macro MYMACRO un&lt;br /&gt;
  Function ${un}myfunc&lt;br /&gt;
    MessageBox MB_OK &amp;quot;This is the function ${un}myfunc.&amp;quot;&lt;br /&gt;
    DetailPrint &amp;quot;Very ${un}funny text.&amp;quot;&lt;br /&gt;
    DetailPrint &amp;quot;More ${un}funny text.&amp;quot;&lt;br /&gt;
  FunctionEnd&lt;br /&gt;
!macroend&lt;br /&gt;
&lt;br /&gt;
; Insert function as an installer and uninstaller function.&lt;br /&gt;
!insertmacro MYMACRO &amp;quot;&amp;quot;&lt;br /&gt;
!insertmacro MYMACRO &amp;quot;un.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Section &amp;quot;Install&amp;quot;&lt;br /&gt;
  ; Call the installer function.&lt;br /&gt;
  Call myfunc&lt;br /&gt;
  &lt;br /&gt;
  SetOutPath &amp;quot;$INSTDIR&amp;quot;&lt;br /&gt;
  ; Write an uninstaller.&lt;br /&gt;
  WriteUninstaller &amp;quot;$INSTDIR\uninstall.exe&amp;quot;&lt;br /&gt;
  ShowWindow $HWNDPARENT 6&lt;br /&gt;
  ; Show the install directory, so you can run the uninstaller straight away.&lt;br /&gt;
  ExecShell open &amp;quot;$INSTDIR&amp;quot;&lt;br /&gt;
  Sleep 1000&lt;br /&gt;
  ShowWindow $HWNDPARENT 9&lt;br /&gt;
SectionEnd&lt;br /&gt;
&lt;br /&gt;
Section &amp;quot;Uninstall&amp;quot;&lt;br /&gt;
  ; Call the un.installer function.&lt;br /&gt;
  Call un.myfunc&lt;br /&gt;
  &lt;br /&gt;
  ; Clean up install directory (delete it).&lt;br /&gt;
  Delete &amp;quot;$INSTDIR\uninstall.exe&amp;quot;&lt;br /&gt;
  RMDir &amp;quot;$INSTDIR&amp;quot;&lt;br /&gt;
SectionEnd&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Code Examples]]&lt;/div&gt;</summary>
		<author><name>JasonFriday13</name></author>
	</entry>
</feed>