Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re:  Haskell exectuable size (Magnus Therning)
   2. Re:  Haskell exectuable size (Henk-Jan van Tuyl)
   3.  Overwriting wxFrame::ProcessEvent in wxHaskell (Nathan H?sken)


----------------------------------------------------------------------

Message: 1
Date: Tue, 3 Sep 2013 15:59:06 +0200
From: Magnus Therning <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] Haskell exectuable size
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

On Tue, Sep 03, 2013 at 03:53:12PM +0400, Dmitry Vyal wrote:
> On 09/03/2013 02:45 PM, Nathan H?sken wrote:
> > I have written a small wxHaskell application. Since wxWidgets
> seems to be required to be linked dynamicly, I have to add the
> wxWidgets dlls. Those make a total of about 25MB, wow.
> >
> > Now the compiled exe (compiled with ghc -O2) has size 15MB.
> > In total I am at about 50Mb, which is just to much.
> >
> > Why is the exe so big?
> > Has anyone a suggestion on how to reduce the total size?
> Bindings for large C libraries contain a great number of Haskell
> wrapper functions for C functions.  Looks like GHC is not terribly
> efficient in terms of size of generated code. Your tiny application
> gets statically linked with a huge haskell library which in turn
> dynamically linked with C library doing the actual work.
> 
> In case you're having multiply haskell binaries using wxWidgets you
> can use GHC's dynamic linking feature. 
> http://www.haskell.org/ghc/docs/7.6.3/html/users_guide/using-shared-libs.html.
> This way actual binaries would be small but would have an additional
> run-time dependency.
> 
> And my question. Does GHC try to exclude unused symbols from Haskell
> libraries it links to application code?

I'm under the impresssion that '--enable-split-objs' enables the
linker to exclude unused symbols/functions when linking to application
code.  I may be completely wrong though.

/M

-- 
Magnus Therning                      OpenPGP: 0xAB4DFBA4 
email: [email protected]   jabber: [email protected]
twitter: magthe               http://therning.org/magnus

I have steadily endeavored to keep my mind free, so as to give up any
hypothesis, however much beloved -- and I cannot resist forming one
on every subject -- as soon as facts are shown to be opposed to it.
     -- Charles Darwin (1809-1882)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20130903/a727cf9e/attachment-0001.sig>

------------------------------

Message: 2
Date: Tue, 03 Sep 2013 21:37:07 +0200
From: "Henk-Jan van Tuyl" <[email protected]>
To: "Haskell Beginners Mailinglist" <[email protected]>, Nathan
        H?sken <[email protected]>
Subject: Re: [Haskell-beginners] Haskell exectuable size
Message-ID: <[email protected]>
Content-Type: text/plain; charset=iso-8859-15; format=flowed;
        delsp=yes

On Tue, 03 Sep 2013 13:48:17 +0200, Henk-Jan van Tuyl <[email protected]>  
wrote:

> The compiled wxcore library (the raw wxWidgets interface) is about 11  
> MB. You can reduce it by about 50%, by using the GHC option -optl-s  
> (this passes the option -s to the linker) to remove the debug data from  
> the executable. This works for all executables, not just wxHaskell users.
>
> The size can further be reduced by running UPX[0], an executable  
> compression utility. UPX can also be used to compress DLLs.

It is also possible to strip the debug data from executables and DLLs,  
using the strip command from MinGW (before running UPX).
For example:
   strip wxmsw295u_xrc_gcc_custom.dll
   upx --best wxmsw295u_xrc_gcc_custom.dll

Regards,
Henk-Jan van Tuyl


-- 
Folding@home
What if you could share your unused computer power to help find a cure? In  
just 5 minutes you can join the world's biggest networked computer and get  
us closer sooner. Watch the video.
http://folding.stanford.edu/


http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
Haskell programming
--



------------------------------

Message: 3
Date: Wed, 04 Sep 2013 10:48:10 +0200
From: Nathan H?sken <[email protected]>
To: Haskell Beginners Mailinglist <[email protected]>
Subject: [Haskell-beginners] Overwriting wxFrame::ProcessEvent in
        wxHaskell
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hey,

In C++ wxWidgets code, I discovered (by looking at the richtext example) 
that when I overwritte the ProcessEvent function of my main frame, a few 
wonderful effects occur:

* Cut/Copy/Paste/Undo/Redo menu entries work out of the box for 
wxTextCtrl and other simply by creating menu items with the correct id.
* The menu items are also updated to be enabled or disabled correctly.

I want that in wxHaskell to! But I do not know if and how I can 
overwrite the ProcessEvent function of wxFrame in wxHaskell ... anyone 
knows if there is a way?
There is windowPushEventHandler, which might be what I want. But it 
takes "EvtHandler a" as argument, and I do not know how to write an 
EvtHandler with my own event handling function ...

Regards,
Nathan

For completeness, the C++ version of what I want (taken from richedit.cpp):

bool MainFrame::ProcessEvent(wxEvent& event)
{
     if (event.IsCommandEvent() && 
!event.IsKindOf(CLASSINFO(wxChildFocusEvent)))
     {
         // Problem: we can get infinite recursion because the events
         // climb back up to this frame, and repeat.
         // Assume that command events don't cause another command event
         // to be called, so we can rely on inCommand not being overwritten

         static int s_eventType = 0;
         static wxWindowID s_id = 0;

         if (s_id != event.GetId() && s_eventType != event.GetEventType())
         {
             s_eventType = event.GetEventType();
             s_id = event.GetId();

             wxWindow* focusWin = wxFindFocusDescendant(this);
             if (focusWin && 
focusWin->GetEventHandler()->ProcessEvent(event))
             {
                 //s_command = NULL;
                 s_eventType = 0;
                 s_id = 0;
                 return true;
             }

             s_eventType = 0;
             s_id = 0;
         }
         else
         {
             return false;
         }
     }

     return wxFrame::ProcessEvent(event);
}




------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 63, Issue 6
****************************************

Reply via email to