<?xml version="1.0" ?>
<kc>

<title>Wine Traffic</title>

<author contact="http://www.theshell.com/~vinn">Brian Vincent</author>
<issue num="305" date="10 Feb 2006 00:00:00 -0800" />
<intro> <p>This is the 305th issue of the Wine Weekly News publication.
Its main goal is to charge batteries. It also serves to inform you of what's going on around Wine. Wine is an open source implementation of the Windows API on top of X and Unix.  Think of it as a Windows compatibility layer.  Wine does not require Microsoft Windows, as it is a completely alternative implementation consisting of 100% Microsoft-free code, but it can optionally use native system DLLs if they are available.   You can find more info at <a href="http://www.winehq.org">www.winehq.org</a></p> </intro>
<stats posts="276" size="443" contrib="92" multiples="56" lastweek="42">

<person posts="19" size="23" who="dank at kegel.com (Dan Kegel)" />
<person posts="15" size="14" who="dmitry at codeweavers.com (Dmitry Timoshkov)" />
<person posts="14" size="16" who="hverbeet at gmail.com (H. Verbeet)" />
<person posts="8" size="25" who="stefandoesinger at gmx.at (Stefan D&#246;singer)" />
<person posts="8" size="12" who="rob at codeweavers.com (Robert Shearman)" />
<person posts="8" size="9" who="eric.pouech at wanadoo.fr (Eric Pouech)" />
<person posts="7" size="9" who="mstefani at redhat.com (Michael Stefaniuc)" />
<person posts="7" size="9" who="thunderbird2k at gmx.net (Roderick Colenbrander)" />
<person posts="7" size="6" who="truiken at gmail.com (James Hawkins)" />
<person posts="6" size="14" who="dcatz at nc.rr.com (Brian Hill)" />
<person posts="6" size="6" who="segin2005 at gmail.com (Segin)" />
<person posts="6" size="5" who="molle.bestefich at gmail.com (Molle Bestefich)" />
<person posts="6" size="4" who="wine.dev at web.de (Detlef Riekenberg)" />
<person posts="5" size="14" who="jorishuizer at planet.nl (Joris Huizer)" />
<person posts="5" size="9" who="wine-devel at kievinfo.com (Vitaliy Margolen)" />
<person posts="5" size="8" who="andi at rhlx01.fht-esslingen.de (Andreas Mohr)" />
<person posts="4" size="20" who="J.A.Gow at furrybubble.co.uk (Dr J A Gow)" />
<person posts="4" size="12" who="claus.fischer at clausfischer.com (Claus Fischer)" />
<person posts="4" size="8" who="fgouget at free.fr (Francois Gouget)" />
<person posts="4" size="8" who="gerald at pfeifer.com (Gerald Pfeifer)" />
<person posts="4" size="8" who="vbudovsk at cs.rmit.edu.au (Vitaly Budovski)" />
<person posts="4" size="7" who="mjung at iss.tu-darmstadt.de (Michael Jung)" />
<person posts="4" size="4" who="n0dalus+wine at gmail.com (n0dalus)" />
<person posts="4" size="4" who="julliard at winehq.org (Alexandre Julliard)" />
<person posts="3" size="16" who="frick at sc-networks.de (Christoph Frick)" />
<person posts="3" size="8" who="james.trotter at gmail.com (James Trotter)" />
<person posts="3" size="6" who="mekaananth at gmail.com (Ananth M)" />
<person posts="3" size="6" who="Phil.Lodwick at EFI.COM (Phil Lodwick)" />
<person posts="3" size="5" who="Stefan.Leichter at camLine.com (Stefan Leichter)" />
<person posts="3" size="4" who="a_villacis at palosanto.com (=?ISO-8859-1?Q?Alex_Villac=ED=ADs_Lasso?=)" />
<person posts="3" size="4" who="the3dfxdude at gmail.com (Jesse Allen)" />
<person posts="3" size="3" who="ckane at intellitree.com (Coleman Kane)" />
<person posts="3" size="3" who="roland.kaeser at swissforex.com (Roland Kaeser)" />
<person posts="3" size="3" who="k04jg02 at kzoo.edu (Joseph Garvin)" />
<person posts="3" size="2" who="twickline at gmail.com (Tom Wickline)" />
<person posts="3" size="2" who="phil at newstar.rinet.ru (Phil Krylov)" />
<person posts="2" size="7" who="fenix at club-internet.fr (Raphael)" />
<person posts="2" size="7" who="mortarn_lists at yahoo.com.au (Joshua Crawford)" />
<person posts="3" size="5" who="marcus at jet.franken.de (Marcus Meissner)" />
<person posts="2" size="3" who="rdorsch at web.de (Rainer Dorsch)" />
<person posts="2" size="3" who="kraftche at cae.wisc.edu (Jason Kraftcheck)" />
<person posts="2" size="2" who="tony.lambregts at gmail.com (Tony Lambregts)" />
<person posts="2" size="2" who="pagoss at gmail.com (Phil Goss)" />
<person posts="2" size="2" who="lionel.ulmer at free.fr (Lionel Ulmer)" />
<person posts="2" size="2" who="speeddymon at gmail.com (Tom Spear (Dustin Booker, Dustin Navea))" />
<person posts="2" size="2" who="infyquest at gmail.com (Vijay Kiran Kamuju)" />
<person posts="2" size="2" who="mike at plan99.net (Mike Hearn)" />
<person posts="2" size="2" who="billmedland at mercuryspeed.com (Bill Medland)" />
<person posts="2" size="2" who="h.davies1 at physics.ox.ac.uk (Huw D M Davies)" />
<person posts="2" size="2" who="mike at codeweavers.com (Mike McCormack)" />
<person posts="2" size="2" who="christian.gmeiner at students.fh-vorarlberg.ac.at (Christian Gmeiner)" />
<person posts="2" size="1" who="wine at troy.rollo.name (Troy Rollo)" />
<person posts="2" size="1" who="dimi at lattica.com (Dimi Paun)" />
<person posts="2" size="1" who="Aric.Cyr at gmail.com (Aric Cyr)" />
<person posts="2" size="1" who="James at superbug.demon.co.uk (James Courtier-Dutton)" />
<person posts="2" size="1" who="juan at codeweavers.com (Juan Lang)" />
<person posts="1" size="4" who="brian.vincent at gmail.com (Brian Vincent)" />
<person posts="1" size="4" who="xtramind at xtramind.com (Xtramind Autoresponder)" />
<person posts="1" size="3" who="elfe-mail at elfe.mine.nu (Karsten Elfenbein)" />
<person posts="1" size="3" who="jsrobinson at gmail.com (Joey Robinson)" />
<person posts="1" size="2" who="penna at bb.com.br" />
<person posts="1" size="2" who="Aric.Cyr at gmail.com (Aric.Cyr)" />
<person posts="1" size="1" who="danielrr at gmail.com (Daniel Rivera)" />
<person posts="1" size="1" who="zhilla at spymac.com (zhilla)" />
<person posts="1" size="1" who="MechWarrior445 at direcway.com (MattK)" />
<person posts="1" size="1" who="fuke at hotmail.com (fu ke)" />
<person posts="1" size="1" who="jchevrier at nexicom.net (Justin Chevrier)" />
<person posts="1" size="1" who="juan_lang at yahoo.com (Juan Lang)" />
<person posts="1" size="1" who="kuba at mareimbrium.org (Kuba Ober)" />
<person posts="1" size="1" who="cmorgan at alum.wpi.edu (Chris Morgan)" />
<person posts="1" size="1" who="loving_eliej at revival-generation.nl (David van der Staak)" />
<person posts="1" size="1" who="n0dalus+redhat at gmail.com (n0dalus)" />
<person posts="1" size="1" who="anime4christ at gmail.com (Aleksey)" />
<person posts="1" size="1" who="wijn at wanadoo.nl (Rein Klazes)" />
<person posts="1" size="1" who="efrias at syncad.com (Eric Frias)" />
<person posts="1" size="1" who="jnewman at codeweavers.com (Jeremy Newman)" />
<person posts="1" size="0" who="cihan at uq.edu.au (Cihan Altinay)" />
<person posts="1" size="0" who="j.dreyer at butonic.de (=?ISO-8859-1?Q?J=F6rn?= Dreyer)" />
<person posts="1" size="0" who="daniel.skorka at stud.uni-karlsruhe.de (Daniel Skorka)" />
<person posts="1" size="0" who="winehacker at gmail.com (Steven Edwards)" />
<person posts="1" size="0" who="rolf.kalbermatter at citeng.com (Rolf Kalbermatter)" />
<person posts="1" size="0" who="bon at elektron.ikp.physik.tu-darmstadt.de (Uwe Bonnes)" />
<person posts="1" size="0" who="kfa at gmx.net (kfa)" />
<person posts="1" size="0" who="martin-fuchs at gmx.net (Martin Fuchs)" />
<person posts="1" size="0" who="ewt at ufl.edu (Eric W. Triplett)" />
<person posts="1" size="0" who="most at museresearch.com (Michael Ost)" />
<person posts="1" size="0" who="pedro.lixo at netcabo.pt (Pedro Maia)" />
<person posts="1" size="0" who="mekjedi at bluebottle.com (MattK)" />
<person posts="1" size="0" who="palm at nogui.se (Christer Palm)" />
<person posts="1" size="0" who="gslink at one.net (gslink)" />

</stats>
<section 
	title="News: Wine 0.9.7 &amp; CXO for Linspire"
	subject="News"
	archive="http://www.linuxelectrons.com/article.php/20060208074505679"
	posts="2"
>
<topic>News</topic>
<mention>Microsoft</mention>
<mention>News</mention>

<p>Alexandre released Wine 0.9.7 last week.  With releases being two weeks
apart there's a little more granularity in the descriptions of new items.
Alexandre noted the following significant changes:</p>
<quote who="Alexandre Julliard"><p><ul>
  <li> Directory change notifications can use inotify now.</li>
  <li> Hardware breakpoints in the Wine debugger.</li>
  <li> Beginnings of support for tape APIs.</li>
  <li> A bunch of improvements to the IDL compiler.</li>
  <li> Better scheme for mapping My Documents etc. to Unix directories.</li>
</ul>
</p></quote>
<p>Good stuff.  Now go grab Wine from 
<a href="http://wiki.winehq.org/GitWine">the GIT repository</a> and compile it.
All the cool kids are doing it.</p>
<p>Am I the only one who still wants to call them Lindows?  </p>
<p>This week CrossOver Office for Linspire was released.  The biggest
thing here is the integration with the distribution.  CXO 5.0 can be
<a href="http://www.linspire.com/search_results.php?q=CrossOver">purchased</a>
directly through Linspire's <i>CNR</i> (click and run) distribution system. 
>From an 
<a href="http://www.linuxelectrons.com/article.php/20060208074505679">article</a>
on LinuxElectrons:</p>
<quote who="LinuxElectrons"><p>
"Businesses tell us they want to switch to the desktop Linux operating 
system to reduce total cost of ownership or improve security, but it's the 
thought of losing one or two software applications  like Quickbooks or 
Microsoft Project  that holds them back," said Kevin Carmony, CEO of Linspire, 
Inc. "CrossOver Office is genius because it removes that hesitation from the 
equation. Yes, you can still use Quicken or Microsoft software on your 
Linspire machine, but you don't have to overpay for a Windows operating 
system license to do it."</p></quote>

</section>
<section 
	title="Eating Dogfood"
	subject="The Dogfood Challenge: use Wine to run your web browser, etc."
	archive="http://www.winehq.org/pipermail/wine-devel/2006-January/044498.html"
	posts="3"
>
<topic>Testing</topic>
<mention>Microsoft</mention>
<mention>cvs</mention>

<p>Dan Kegel thought some Wine developers should start eating their
own dogfood:</p>
<quote who="Dan Kegel"><p>
Say, if we're expecting people to use Wine for real
work, maybe we should start doing that ourselves.
</p><p>
Firefox-1.5 runs pretty well on Wine.
How many Wine developers use it on Wine as their main web browser?
Maybe we could raise that number from zero to somewhere
around ten, and flush out a couple bugs.
</p><p>
Speaking of flushing out bugs,
OpenOffice 1.1 was said to work well under wine
a couple years ago (though I don't think I ever saw it
do so myself).  Sadly, although OpenOffice 1.1.5 seems
to install fine under current wine, it crashes quickly on
startup, so I guess we have a bit of work to do first.
The extra payoff would be being able to use
<a href="http://qa.openoffice.org/qatesttool/">http://qa.openoffice.org/qatesttool/</a>
to run OpenOffice's automated
test suite as an automated regression test for wine.
</p><p>
One complication in all this is having to teach yourself
to not automatically blow away your ~/.wine directory
when trying a new app!
</p></quote>

<p>He followed up on that later in the day with some benchmarks to
prove Wine's performance isn't too far off native:</p>
<quote who="Dan Kegel"><p>
To see how reasonable it might be to use OOo 2.0.1 and Firefox 1.5
under Wine routinely, I benchmarked their startup time
on a Fedora Core 5 test 2 system under four conditions:
native vs. with wine from cvs, and with 416MB RAM vs. 96 MB RAM
(by booting with mem=96M; this was to simulate running on
one of those cheapo 128MB boxes that uses shared video RAM).
This was on a zippy Compaq Presario 3000 Athlon 64 3000+.
All apps were downloaded from openoffice.org and mozilla.com.
</p><p>
Results for first run of app after booting (1st column is startup time):
<ul>
5 Firefox run1 native 416MB<br />
12 Firefox run1 wine 416MB<br />
11 Firefox run1 native 96MB<br />
15 Firefox run1 wine 96MB<br />
11 ooo run1 native 416MB<br />
15 ooo run1 wine 416MB<br />
60 ooo run1 native 96MB<br />
37 ooo run1 wine 96MB</ul></p><p>

So wine is 1.4 to 2.5 times slower at app startup generally,
but when ram is really short, win32 openoffice starts
up with wine 1.5 times *faster* than the native linux version!
(Maybe because the Microsoft tools are better at avoiding I/O
or relocations during loading?)
</p><p>
I then measured how long it took to start up the app the second
time, when the cache was nice and hot:
<ul>
3 Firefox run2 native 416MB<br />
4 Firefox run2 wine 416MB<br />
4 ooo run2 native 416MB<br />
6 ooo run2 wine 416MB<br />
4 Firefox run2 native 96MB<br />
6 Firefox run2 wine 96MB<br />
36 ooo run2 native 96MB<br />
28 ooo run2 wine 96MB</ul></p><p>

The times are uniformly faster on the second run,
but the patter holds, i.e. wine is 1.4-1.5 times slower than native
generally, but win32 openoffice under wine is 1.5 times *faster* than
the native version when starved for RAM.
</p></quote>

<p>There was concern FC5 might be throwing off the results, but Dan
tried with Ubuntu 5.10 and found similar results.</p>
</section>
<section 
	title="MP3 Decoding"
	subject="MSACM: winemp3 codec crashes on seek, (no longer) reimplement with libmad?"
	archive="http://www.winehq.com/pipermail/wine-devel/2006-February/044709.html"
	posts="8"
>
<topic>Multimedia</topic>
<p>Wine's MP3 codec for playing back MP3 audio seems to have some issues.
Alex Villacis Lasso spent some time looking at it and wrote to wine-devel
to see if anyone had any ideas for improving it:</p>
<quote who="Alex Villacis Lasso"><p>
I was trying to exercise the winemp3 builtin codec using a Visual Basic 
control that essentially implements the Windows Media Player look 
(MSDXM.OCX). After specifying native quartz.dll for this app, I tested a 
few AVIs with mp3-encoded soundtracks. What I can notice is that the 
sound has very annoying jitters, and in addition, it crashes on a seek. 
Some people have noticed the jitters too 
(
<a href="http://bugs.winehq.org/show_bug.cgi?id=3853">http://bugs.winehq.org/show_bug.cgi?id=3853</a>). However, rather than 
trying to fix the wine fork of mpeglib, I was toying with the idea of 
reimplementing the codec as a libmad (GPL) wrapper. Are there any issues 
I should take into account before trying this?</p></quote>

<p>Eric Pouech replied,
<quote who="Eric Pouech">

first of all, are we sure that the issue comes from the decoder itself 
(and not some wine wrapper around it) ?
the second issue is that MAD is GPL... hence we cannot use it</quote></p>

<p>Alex investigated the decoder more closely,
<quote who="Alex Villacis Lasso">

I performed the following test: with the sample VB application, I 
modified the winemp3 code to write the input buffer (mp3) and the 
decoded output buffer (PCM) at the end of separate files. Then I played 
the mp3 samples file. This one plays correctly (rules out mangling of 
input buffers). The output file has quirks, but plays a little better 
than the output from the VB application (no delays), which suggest that 
there are some timing issues with the winemp3 code, or that the output 
duration, as reported by winemp3, is slightly incorrect.</quote></p>

<p>Alex also pondered resyncing with the latest version of mpglib.</p>

<p>Eric thought the test didn't take into accoutn some other possibilities:</p>
<quote who="Eric Pouech"><p>
Or simply, that the sequence of:
<ol>
<li> getting mp3 encoded data</li>
<li> pushing them to the decoder for decoding</li>
<li> pushing the decoded data to the speaker</li></ol>
runs slower than the expected pace...</p><p>
which doesn't blame only step2, or the decoder itself. for example, 
putting the decoder in a separate thread would greatly improve, or using 
smaller packets in step 1.
</p></quote>

<p>Alex dug further:</p>
<quote who="Alex Villacis Lasso"><p>

I also ran tests with a different movie which uses the Indeo codecs 
(native) for decoding. This one runs smoothly (with audio AND video). In 
my opinion, this is additional evidence that the winemp3 codec is at 
fault (especially since my sample movie uses a not-installed DivX video 
codec which therefore does not consume any CPU, as it is running in 
audio-only mode). The native Indeo codec also does not crash on seek.
</p><p>
On a side note, is there anybody in the list with experience with 
GStreamer programming? The base GStreamer framework is LGPL, so it 
*might* be legally possible to write a GStreamer wrapper for wine. Of 
course, there might be an architecture difference that makes this 
impossible, so any feedback will be appreciated.</p></quote>

<p>Followed by:</p>
<quote who="Alex Villacis Lasso"><p>

Some more tests. I downloaded the latest version of mpglib, and compared 
it against the wine fork. Aside from extra spaces and an one-time-only 
initialization in the wine code, the current mpglib code is almost 
identical to the wine fork. However, the standalone mpglib decodes the 
extracted samples correctly. This means that there is something about 
the Wine environment that disturbs mpglib enough so that decoding no 
longer works correctly. I also noticed that mpglib uses malloc() and 
free() from glibc even inside the wine copy (one malloc()/free() pair 
per sample block to be decoded). Could this be causing some interference 
(especially since the wine architecture decodes in a separate thread)? 
Maybe it is worth it to use HeapAlloc()/HeapFree() instead.</p></quote>

<p>Eric didn't think HeapAlloc was necessary.  That was the end of the
discussion, but it seems like Alex is still looking into it.</p>
</section>
<section 
	title="Demangling Symbols"
	subject="VC++ demangling tool"
	archive="http://www.winehq.com/pipermail/wine-devel/2006-February/044758.html"
	posts="9"
>
<topic>Utilities</topic>
<p>Automatically demangling symbols generated by Visual C++ is a handy feature.
Michael Stefaniuc came up with a new, little Winelib app to do it: </p>
<quote who="Michael Stefaniuc"><p>

 winedump has a VC++ symbol demangling function but that is bitrotting as
 it is a copy of the msvcrt.__unDname . As i wanted to use the newer
 msvcrt.__unDname funtion i have written a quick and dirty program that
 is basicaly only a wrapper around UnDecorateSymbolName(). Most importent
 feature is that it runs on the command line.
 I'm not expecting it to go into Wine but others might find it useful.
 After applying the patch configure needs to be regenerated.
</p></quote>

<p>Eric Pouech pointed out there's an MS tool that does exactly that:</p>
<quote who="Eric Pouech"><p>

actually, there's a tool in the MS SDK called undname that does exactly 
this... it has also a couple of other options (like demangling all 
symbols listed in a text file)...
</p><p>
but what should be done is to port back the code from msvcrt into winedump
</p></quote>

<p>The last thought prompted Michael to ask,
<quote who="Michael Stefaniuc">
I'm wondering, why can't winedump import msvcrt and call what it needs, 
instead of duplicating code?</quote></p>

<p>Eric gave two reasons:</p>
<quote who="Eric Pouech"><p>
<ul>

<li> because we don't want winedump to be winelib app</li>
<li> because winedump does a bit more than just demangling (like adding pmt 
names) which requires an extra level of intelligence that doesn't exist 
in msvcrt.__undname</li></ul></p></quote>

<p>Then a discussion ensued about whether winedump should become a Winelib
app.  Almost everyone was opposed to it, but there seemed to be a strong
argument for being able to utilize Wine's msvcrt.dll rather than duplicating
code.</p>
</section>
<section 
	title="Winelib &amp; Easy Distribution"
	subject="Somewhat disappointing experiences with Winelib and WTL"
	archive="http://www.winehq.com/pipermail/wine-devel/2006-February/044685.html"
	posts="11"
>
<topic>Winelib</topic>
<mention>Boaz Harrosh</mention>

<p>Claus Fischer looked into using Winelib and 
<a href="http://wtl.sourceforge.net/">WTL</a> for simple application
development and deployment.  He sent a rather
long summary of what he discovered:</p>
<quote who="Claus Fischer"><p>

Over the last few days, I have been trying to find out whether
the combination of WTL and Winelib could be a promising
inter-platform GUI solution.
</p><p>
While I have made some progress and got some new knowledge,
I believe I have now come to a dead end where I'll have
to give up that attempt.
</p><p>
In case you are interested, here's my summary report.
</p><p>
It might be useful to others.

</p><p>
<u>The Goal:</u>
</p><p>
WTL on Windows gives me:
<ul><li> compact executables: small and fast</li>
<li> easy-to-install executables: no DLLs needed</li>
<li> programs easy to maintain and deploy</li>
<li> mature GUI</li></ul>

</p><p>
The goal is to combine WTL/ATL (no COM) with Winelib
to create a Linux-application with the same look and
feel and roughly the same qualities: no DLL's,
shared libraries, C++ ABI hassles, etc.
Just one binary linked to libc.

</p><p>
<u>1. ATL/WTL</u>
</p><p>
ATL 3.0 (from my MSVC 6 compiler) and WTL 7.5
(from sourceforge) can be made to work. Issues are:
<ul><li> GCC 4 is very picky with templates and would need
 lots of template prototypes; I have used GCC 3.3.5</li>
<li> Some template prototypes are still needed</li>
<li> Some MSVC-specific pragmas etc. need to be ifdef'd</li>
<li> A few pack pragmas need to be replaced by Wine's
 pack headers</li>
<li> Everything related to _get_uuid(class) I've
 commented out; I need no COM stuff</li>
<li> Some GCC warnings need to be turned off,
 or alternatively code changes need to be made</li>
<li> Various small changes</li>
<li> As more parts of WTL get used (i.e. instantiated),
 more changes will be required</li></ul>
</p><p>
Basically, ATL+WTL can reach a state where they compile
with GCC 3 and the changes are still mostly cosmetic.
Some of the changes might even be incorporated in the
official WTL, now that it's free.
</p><p>
I have read the mails of Boaz Harrosh' previous changes;
apparently he has had to invest much more work because
of COM.
</p><p>
With the modified ATL/WTL, I was able to compile the
wizard-created sample SDI application on Linux.

</p><p>
<u>2. Winelib "as is"</u>

</p><p>
After some digging through the Web, I've been able to
link the sample SDI application against Winelib.
</p><p>
It took somewhat longer than it should have due to
<ol>
<li> WTL's habit of just ATLASSERT()ing things and</li>
<li> the rather elaborate work of finding those places with
   wine-dbg and/or ATLTRACE()s plus <tt>WINEDEBUG=+relay</tt>.</li></ol>
</p><p>
Since I'm not familiar with the Wine debugger, it
would have been very helpful to be able to use
gdb on the resulting executable.
However, gdb reported that it didn't know
the file format.
</p><p>
Wishlist for Wine:
   <ul><li> Make gdb work on Winelib programs</li>
   <li> Document Winelib and the build process better
     (the documentation is outdated, though the
     tools are good).</li></ul>
</p><p>
All in all a reasonably successful endeavour,
and the application runs stable and looks fine
except for the font (that probably can be configured
better).

</p><p>
BUT: ... BIG SHOCK: That's not a single ELF executable,
it's a weird mixture of PE and ELF and a .so file and
a wrapper program that apparently starts wine in the
background ...
</p><p>
That doesn't fulfill my goals of building a native
Linux exe with no dependencies except libc.
</p><p>
It's also quite slow when loading.

</p><p>
<u>3. Winelib statically linked</u>

</p><p>
Apparently Wine has made a decision a few years ago:
that support for native Windows apps with all the
infrastructure they need (Wine server, registry,
resources, multithreading, etc.) is more important
than support for porting applications to native
Linux apps.
</p><p>
That decision is obviously correct, given the
large number of Windows applications that are
only available as binaries and require much
infrastructure.
</p><p>
I'm aware of that, but I've still decided to give
my dream of a native Linux app a try.

</p><p>
I tried the following method:
<ol>
<li> Get and compile Wine 0.9.7</li>
<li> Add rules to Makedll.rules to pack the objects
   into .a libraries</li>
<li> Attempt to link my program's objects
   against those static libs</li>
<li> Make changes and corrections and repeat</li></ol>
</p><p>
I first made a reduced WTL application that does not
use a resource file. I don't know if this was a good
decision.
</p><p>
The following changes were necessary to Wine:
<ul><li> Comment out a lot of DLLMain functions</li>
<li> Comment out some 16-bit functions that have
 name collisions</li>
<li> Turn on debug mode (-O0 -g)</li>
<li> Write a startup function main()
 (Wine's libwinecrt0.a didn't work for me)
 That might be the reason for more trouble</li>
<li> Link to all of libs/unicode</li>
<li> Link to some objects in libs/wine
 (I didn't link to loader, don't know if that's good)</li></ul>
</p><p>
This is where the heavy trouble started:
<ul><li> Replace the assembly stuff in critical sections
 (due to the debug mode)
 ... my app is single-threaded</li>
<li> Somehow set up code pages for ansi/Unix
 (LocaleInit() failed, see below)</li>
<li> Comment out some calls to the registry
 where the run-time environment is registered</li></ul>
</p><p>
What eventually caused me to stop is:
<ul><li> Somehow fake Wine Server
 or do the equivalent stuff or just jump over
 (Basically Register Class as atoms)</li>
<li> Somehow fake a lot of initial resources
 (E.g. GetSystemCursor etc.)</li>
<li> Overall too many modifications in interacting systems</li>
<li> Altogether not a "robust" feeling</li></ul>
</p><p>
This is where I stopped.
</p><p>
I don't know whether I'm "so close" or miles away,
but my random code editing seemed to get out of hand.
</p><p>

<u>4. What is needed</u>

</p><p>
What would be needed to support static linking against
Winelib (if that's decided to be a supportworthy goal):

<ul><li> Infrastructure to build static libs
 <ul>
 <li> separate out DllMain</li>
 <li> separate out some 16 bit functions</li></ul></li>

<li> Possibility to provide heap based allocation
 through straight malloc()</li>

<li> Infrastructure to fake loading resources
 (for those resources that come from Winelib/system)</li>

<li> Infrastructure for proper initialization of modules
 e.g. through one setup function for each DLL
 and one common setup function that calls the others
 in some natural order.
 The overall initialization function should be
 configurable so that programs that need only
 a few DLL's (user, gdi, crtdll, kernel, ntdll)
 don't need to link everything</li>

<li> Infrastructure to allow faking registry calls
 for those calls initiated by Winelib internal
 stuff (and possibly also ATL/WTL internal stuff)</li>

<li> Infrastructure to handle Window class registration
 etc. (i.e. reduced Wine server support in the app)</li></ul>
</p><p>

What I specifically don't need/want through Winelib:
<ul><li> networking</li>
<li> filesystem access</li>
<li> loading of external DLL's or other libraries</li>
<li> C++ runtime library support</li></ul></p><p>

Also, if anyone is interested in hosting patches to ATL/WTL
or even just looking at them, I'll gladly provide them.</p></quote>


<p>Rob Shearman pointed out the wineserver is a necessary component:</p>
<quote who="Rob Shearman"><p>

You really don't want to try without wineserver support. Nearly
everything depends on at least one feature that the wineserver provides.
If you try to make your own version of wineserver that is somehow
statically linked into the application you will have to completely
change how it works and maintain that version on your own.
</p><p>
You're doing a noble thing in trying to get your Winelib application
easy to deploy, but I think you're going about it the wrong way.
</p><p>
For maintainability, take a look at using the WINEPREFIX environment
variable and use dynamic libraries. That way you can deploy upgrades of
your application in a small installer, whilst not needing to update the
Wine libraries. If you need a bug fix in a Wine library, then you can
just update the one dynamic library that has changed.
If the startup speed isn't good enough for you, you can use oprofile (or
some other profiling framework) to work out which functions are taking
up time. We would welcome any fixes to improve the startup speed.
Optionally, you could comment out functions do things that you don't need.
</p></quote>

<p>Claus explained a bit more about the application and ho he'd like to 
deploy it:</p>
<quote who="Claus Fischer"><p>

But with WTL, it's possible to build a reasonable sophisticated
application that depends only on DLLs that are already on the
system.
</p><p>
My biggest WTL application so far, a project for the Austrian
Mountain Rescue Service, has roughly 100.000 lines of code
(sloccount). You can find a description on
 <a href="http://www.clausfischer.com/eis.en.html">
 http://www.clausfischer.com/eis.en.html</a>
(a bit outdated though).
</p><p>
When the first phase was finished, the program would still
run under Windows 98 SE upwards. It now depends on the
following DLL's:

  VERSION,
  WS2_32,
  KERNEL32,
  USER32,
  GDI32,
  COMDLG32,
  ADVAPI32,
  SHELL32,
  OLE32,
  WININET,
  COMCTL32</p><p>

On any reasonable PC with internet access (it's a networked
application talking to several redundant data servers),
you will find those.
</p><p>

Therefore, Installation is as easy as copying the EXE and
starting.
</p><p>
That is a requirement, since the Montain Rescue Service is
a volunteer organization with members from all kinds of
social background, work environment, and Laptop
infrastructure.
</p><p>

For this reason, having WTL+Winelib for Linux would have
been just too nice to think of :-)</p></quote>

<p>That prompted Dmitry Timoshkov to point out the underlying facilities
to support those DLL's were non-trivial,
<quote who="Dmitry Timoshkov">
You seem to underestimate what the dependencies above mean for the
running Windows system. You depend on the <i>whole</i> kernel + GUI
subsystems, including registry and everything else. That's true
for Wine as well, just in the case of Wine you see all the dependencies,
not just the imports section of your exe file.</quote></p>

<p>Claus felt the goals of Winelib had fallen by the wayside, which is
partially true,
<quote who="Claus Fischer">


However, through all that progress supporting native Windows
applications (which must be the main goal, of course), the
"portable Windows GUI" idea has naturally fallen by the
wayside somewhat, and the usefulness of Winelib as an
application porting toolkit is therefore questionable.</quote></p>

<p>Mike Hearn felt Wine wasn't the tool for the job in question:</p>
<quote who="Mike Hearn"><p>


Win32 in general could never be described as "promising" no
matter what libraries you wrap it with. Wine is best used for porting and
compatibility rather than new app development. Libraries like GTK or Qt
are far better

</p><p>

Your <i>actual</i> goal is described here - you want a program that is free of
dependency hell. A noble goal indeed, but the right way to do this is to
investigate things like autopackage, ELF statifier, and so on. And also to
accept that a program with no dependencies is perhaps not so useful after
all. For instance, you can probably find GTK+ 2.2 or higher on everybodies
system these days.</p></quote>

</section></kc>
