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

<title>Wine Traffic</title>

<author contact="http://www.theshell.com/~vinn">Brian Vincent</author>
<issue num="298" date="04 Nov 2005 00:00:00 -0800" />
<intro> <p>This is the 298th issue of the Wine Weekly News publication.
Its main goal is to start skiing again. 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="261" size="478" contrib="88" multiples="50" lastweek="49">

<person posts="13" size="36" who="davmac at davmac.org (Davin McCall)" />
<person posts="13" size="25" who="titan.costa at wanadoo.fr (Christian Costa)" />
<person posts="13" size="17" who="julliard at winehq.org (Alexandre Julliard)" />
<person posts="10" size="12" who="wino at piments.com" />
<person posts="10" size="11" who="lionel.ulmer at free.fr (Lionel Ulmer)" />
<person posts="9" size="14" who="vberon at mecano.gme.usherb.ca (Vincent B&#233;ron)" />
<person posts="8" size="15" who="the3dfxdude at gmail.com (Jesse Allen)" />
<person posts="7" size="10" who="rob at codeweavers.com (Robert Shearman)" />
<person posts="7" size="10" who="rddone at att.net (Rob D)" />
<person posts="7" size="6" who="daniel.r.kegel at gmail.com (Dan Kegel)" />
<person posts="6" size="32" who="oliver_stieber at yahoo.co.uk (Oliver Stieber)" />
<person posts="6" size="9" who="andi at rhlx01.fht-esslingen.de (Andreas Mohr)" />
<person posts="5" size="11" who="wine at eternaldusk.com (Evil)" />
<person posts="5" size="10" who="rwalls at gwi.net (Randall Walls)" />
<person posts="5" size="7" who="wine-devel at kievinfo.com (Vitaliy Margolen)" />
<person posts="5" size="5" who="truiken at gmail.com (James Hawkins)" />
<person posts="5" size="3" who="dimi at lattica.com (Dimi Paun)" />
<person posts="4" size="11" who="fenix at club-internet.fr (Raphael)" />
<person posts="4" size="10" who="jrliggett at cox.net (James Liggett)" />
<person posts="4" size="6" who="hverbeet at gmail.com (H. Verbeet)" />
<person posts="4" size="6" who="Jonathan at ErnstFamily.ch (Jonathan Ernst)" />
<person posts="4" size="5" who="reuben at ugcs.caltech.edu (Walt Ogburn)" />
<person posts="4" size="4" who="Paul.Vriens at xs4all.nl (Paul Vriens)" />
<person posts="4" size="3" who="mike at codeweavers.com (Mike McCormack)" />
<person posts="3" size="8" who="bobl at optushome.com.au (Robert Lunnon)" />
<person posts="3" size="7" who="juergenw_ at web.de (Juergen Wieczorek)" />
<person posts="3" size="7" who="a_villacis at palosanto.com (=?ISO-8859-1?Q?Alex_Villac=ED=ADs_Lasso?=)" />
<person posts="3" size="5" who="mjung at iss.tu-darmstadt.de (Michael Jung)" />
<person posts="3" size="4" who="bon at elektron.ikp.physik.tu-darmstadt.de (Uwe Bonnes)" />
<person posts="3" size="4" who="molle.bestefich at gmail.com (Molle Bestefich)" />
<person posts="3" size="3" who="marcus at jet.franken.de (Marcus Meissner)" />
<person posts="3" size="3" who="mike at plan99.net (Mike Hearn)" />
<person posts="3" size="2" who="kuba at mareimbrium.org (Kuba Ober)" />
<person posts="2" size="13" who="pabs3 at bonedaddy.net (Paul Wise)" />
<person posts="2" size="4" who="mizvekov at gmail.com (Matheus Izvekov)" />
<person posts="2" size="4" who="tmartin_usa at yahoo.com (Tim Martin)" />
<person posts="2" size="3" who="reif at earthlink.net (Robert Reif)" />
<person posts="2" size="3" who="jnewman at codeweavers.com (Jeremy Newman)" />
<person posts="2" size="3" who="winehacker at gmail.com (Steven Edwards)" />
<person posts="2" size="3" who="Thomas.Tornblom at Hax.SE (Thomas Tornblom)" />
<person posts="2" size="3" who="fgouget at free.fr (Francois Gouget)" />
<person posts="2" size="2" who="ivg2 at cornell.edu (Ivan Gyurdiev)" />
<person posts="2" size="2" who="dmitry at baikal.ru (Dmitry Timoshkov)" />
<person posts="2" size="2" who="sonix2003 at ctf-z.de (Andreas Rosenberg)" />
<person posts="2" size="2" who="fuchs.martin at gmail.com (Martin Fuchs)" />
<person posts="2" size="2" who="eric.pouech at wanadoo.fr (Eric Pouech)" />
<person posts="2" size="1" who="stefandoesinger at gmx.at (Stefan D&#246;singer)" />
<person posts="2" size="1" who="wine-patches at reactsoft.com (Thomas Weidenmueller)" />
<person posts="2" size="1" who="jonwil at tpgi.com.au (Jonathan Wilson)" />
<person posts="2" size="1" who="wine at troy.rollo.name (Troy Rollo)" />
<person posts="1" size="8" who="paul at astro.gla.ac.uk (Paul Millar)" />
<person posts="1" size="5" who="marcos_vc at coel.com.br (Marcos Vicente Cruz)" />
<person posts="1" size="4" who="frick at sc-networks.de (Christoph Frick)" />
<person posts="1" size="4" who="a_villacis at palosanto.com (=?ISO-8859-15?Q?Alex_Villac=ED=ADs_Lasso?=)" />
<person posts="1" size="3" who="kdekorte at yahoo.com (Kevin DeKorte)" />
<person posts="1" size="3" who="atuel at tuel.org (Anthony R. Tuel)" />
<person posts="1" size="2" who="saulius2 at ar.fi.lt (Saulius Krasuckas)" />
<person posts="1" size="2" who="dns at somacoma.de (Daniel Stodden)" />
<person posts="1" size="2" who="paul.vriens at xs4all.nl (Paul Vriens)" />
<person posts="1" size="2" who="Phil.Lodwick at EFI.COM (Phil Lodwick)" />
<person posts="1" size="2" who="bernds_cb1 at t-online.de (Bernd Schmidt)" />
<person posts="1" size="2" who="julienc at psychologie-fr.org (julien)" />
<person posts="1" size="2" who="cihan at uq.edu.au (Cihan Altinay)" />
<person posts="1" size="2" who="markus.amsler at oribi.org (Markus Amsler)" />
<person posts="1" size="2" who="sergio.t at videotron.ca (Sergio)" />
<person posts="1" size="2" who="david.guembel at gmx.de (David G&#252;mbel)" />
<person posts="1" size="2" who="stodden at cs.tum.edu (Daniel Stodden)" />
<person posts="1" size="1" who="stefandoesinger at gmx.at (Stefan D&#246;singer)" />
<person posts="1" size="1" who="j_anderw at sbox.tugraz.at (Johannes Anderwald)" />
<person posts="1" size="1" who="a_villacis at palosanto.com (=?ISO-8859-2?Q?Alex_Villac=ED=ADs_Lasso?=)" />
<person posts="1" size="1" who="info at sparsi.com (=?iso-8859-1?B?SW5mb3JtYef1ZXM=?=)" />
<person posts="1" size="1" who="david.goodenough at btconnect.com David Goodenough" />
<person posts="1" size="1" who="tom at dbservice.com (Tomas Carnecky)" />
<person posts="1" size="1" who="wino at jentronics.com (Ron Jensen)" />
<person posts="1" size="1" who="infyquest at gmail.com (Vijay Kiran Kamuju)" />
<person posts="1" size="1" who="sergio.t at videotron.ca (Brenda y Sergio)" />
<person posts="1" size="1" who="p.beutner at gmx.net (Peter Beutner)" />
<person posts="1" size="1" who="pebl at math.ku.dk (Peter Berg Larsen)" />
<person posts="1" size="1" who="wine.dev at web.de (Detlef Riekenberg)" />
<person posts="1" size="0" who="peter at piments.com" />
<person posts="1" size="0" who="lav at etersoft.ru (Vitaly Lipatov)" />
<person posts="1" size="0" who="LAV at vl3143.spb.edu (Vitaly Lipatov)" />
<person posts="1" size="0" who="xerox_xerox2000 at yahoo.co.uk (Robbert Xerox)" />
<person posts="1" size="0" who="ivanleo at gmail.com (Ivan Leo Puoti)" />
<person posts="1" size="0" who="hans at it.vu.nl (Hans Leidekker)" />
<person posts="1" size="0" who="boaz at hishome.net (Boaz Harrosh)" />
<person posts="1" size="0" who="meissner at suse.de (Marcus Meissner)" />

</stats>


<section 
	title="News: Another Beta Article"
	subject="News"
	archive="http://www.itjungle.com/tlb/tlb110105-story05.html"
	posts="1"
>
<topic>News</topic>
<mention>News</mention>

<p>
A short bit of news covering Wine's beta release was in
<a href="http://www.itjungle.com/tlb/tlb110105-story05.html">IT Jungle</a>
this past week.  From the article:</p>
<quote who="IT Jungle"><p>
The Wine emulator will allow popular Windows desktop and server applications to
 run on Linux and Unix without the need for a Windows platform. This is a goal 
that many people have tried to shoot for in other operating systems--lxrun 
inside various Unixes and Windows 3.0 inside of OS/2, just to name two--and 
such emulation has received mixed results in the market because emulators 
tend to make emulated applications run slowly and emulators are often cranky 
and buggy. Now is your chance to see if the open source Win Project community 
can--and has done--a better job than prior commercial emulators of the 
past. </p></quote>
</section>
<section 
	title="WineProbe, Part II"
	subject="WineProbe part II; Propaganda for Wine"
	archive="http://www.winehq.com/pipermail/wine-devel/2005-November/041969.html"
	posts="4"
>
<p>David G&#252;mbel announced some news coming out of Germany:</p>
<quote><p>
As most of you probably remember, my company (ITOMIG) launched an initiative 
called WineProbe (=~ "WineTasting" in English) some time ago. As part of 
this initiative, we're arranging an informational event next week on 
thursday afternoon in Stuttgart. We'll present Wine and its capabilities 
for migrating and porting applications to Unix. Details are 
<a href="http://www.itomig.de/Initiative_Wine-Probe.26.0.html">available 
online</a> (in German).
</p><p>
The target audience are software vendors who would like to create a Linux or 
cross-platform version of their Windows-based products. However, anyone 
interested is cordially invited to come, listen and discuss, and have a 
glass of good wine afterwards ;) The event is free, you just need to send 
us a 
<a href="http://www.itomig.de/Initiative_Wine-Probe.26.0.html">small application form</a> available online.
</p><p>

Aside from that, I wrote an article titled "Grenzen 
&#252;berschreiten" ("Crossing Borders") about Wine and its use in the city of 
B&#246;blingen in a project we're running together with B&#246;blingen and
T&#252;bingen
University. It was published in print this week in the magazine 
<a href="http://www.kommune21.de">Kommune21</a>. 
Kommune21 is a magazine about the use of information technology in 
municipalities (german: "Kommunen"). About 11 000 copies are printed every 
month, and I'd say the CIO of pretty much every major german city has a 
subscription. 
</p><p>
They do not normally have a free online version of their contents available. 
However, they provided me with a PDF of the article, which we're allowed to 
put online on our web site. I think this is very nice advertisement for 
Wine, in particular because of the very specific audience of that 
publication. Anyone interested can find the article available online at 
<a href="http://www.itomig.de/Downloads.10.0.html">http://www.itomig.de/Downloads.10.0.html</a>.
</p></quote>


</section>
<section 
	title="Multimonitor Support"
	subject="Multimonitor support in Wine?"
	archive="http://www.winehq.com/pipermail/wine-devel/2005-October/041828.html"
	posts="5"
>
<topic>Graphics</topic>
<p>Two threads popped up this week that ended up being related.  We'll
cover them as two separate threads.  Rob Done had a Winelib app he 
wanted to run on Solaris x86:</p>
<quote who="Rob Done"><p>
Ive been trying to figure how to get a (single) Wine application to be able
to display dialogs on each of 3 monitors in a non xinerama setup (DISPLAY
:0.0, :0.1, and :0.2).
</p><p>
I am well aware that xinerama mode would allow this quite easily, but
xinerama is not an option, partly since CDE on Solaris will not work in
xinerama mode, and a little thing called Software Requirements Specification.
</p><p>
I am also aware this isnt specifically a wine issue, but in researching
what could be done about over the past week, I found several references to
gdi_display, x11drv_thread_data, and various other constructs and class
members in Wine that describe which display to use. This leads me to
believe there is some method to allow Wine to enable the desired functionality.
</p><p>
Whether the method to support this functionality is built in or needs to be
coded, I have not yet determined, since nearly every file in dlls/x11drv
directory uses these members and constructs.
</p><p>
If someone has any insight on how to implement this or where I should focus
my efforts, it would be very helpful.
</p></quote>

<p>Marcus Meissner described some ideas and translated from Windows to 
Unix-speak:</p>
<quote who="Marcus Meissner"><p>

The .x DISPLAY component is "Screen" in X11 speak.
</p><p>
So far we have no special X11 Screen handling in our code as far as I know.
</p><p>
I would also not know how to map the Windows API to X11 Screens :/
There are "WindowStations"</p></quote>

<p>Rob thought about it more and came up with something to try,
<quote who="Rob Done">
Since alot of the Wine code refers to "thread_display" attributes, I spose
I could try to create a separate helper thread for each display, each
somehow kludged to link to a separate display at startup, and marshal
display requests for each, but it seems that there could be an easier way.
</quote></p>

<p>Thomas Tornblom wanted to know why he didn't just use Xinerma, but 
Rob replied that it only worked with Sparc machines.  Rob persued some
different techniques for getting his app to display on different monitors,
but nothing seemed to work.  Then the next thread popped up...</p>
</section>
<section 
	title="Multiple App Support"
	subject="wine for two, please."
	archive="http://www.winehq.com/pipermail/wine-devel/2005-November/041868.html"
	posts="6"
>
<p>
Someone wanted to know how to get two Windows apps to  talk to each
other with Wine:</p>
<quote who="wino_at_piments.com"><p>
I dont know much about the message queue works on Wine but wondered if  
there was means of running two progams in the same context on wine in such  
a way that they use the same message queue and can therefore potencially  
interact.
</p><p>
As I understand it, running two instance of command line wine is more  
analogous to having two different computers running each app under windows.
</p><p>
My goal is getting NatSpeak dictated text messages freed from the confines  
of the wine instance of the app. This would seem to be one approach if  
wine can run more than one process at a time.</p></quote>

<p>Marcus Meissner explained Wine was not like having two separate computers
and was specifically designed for something like that to work:</p>
<quote who="Marcus Meissner"><p>
Running two "wine foo.exe" will act as if on the same machine, including
interchange of windows messages if the apps do that.</p></quote>

<p>The original poster reported success:</p>
<quote who="wino_at_piments.com"><p>
Many thanks, that is indeed what happens.
</p><p>
And the best part: Dragon can actually type into editboxes on a  
concurrently running app!
</p><p>
None of the voice control stuff works, even internally, so I may get to  
looking into that mechanism later to see if it can be made to work. (eg  
"click file" should bring down the file menu) Indeed this seems to upset  
the dictation function and leaves it in an inconclusive state . Playing  
back some text seems to clear it tho'.
<ul><code>
fixme:menu:GetSystemMenu not supported on other process window 0x1401f2
fixme:imm:ImmGetDefaultIMEWnd (0x1401f2 - 0x501f0 0x784c89d8 ): semi-stub
fixme:imm:ImmGetDefaultIMEWnd (0x1401f2 - 0x501f0 0x784c89d8 ): semi-stub
</code></ul>
</p><p>
This does not look too far from working either.
</p><p>
Now the big one here is to get this output sent to Linux programs. I have  
been considering different routes to this end.
<ol>

<li> Using winedebug  or spy output piped through grep then somehow  
injecting it into various X programs.</li>

<li> Patching something into wine or better hooking into and existing  
mechanism  that could send the output to the X window with the input focus.</li>

<li> Using wininet to open a link to a bespoke client on 127.0.0.1 that  
could redirect the output in X.</li></ol>
</p><p>
As you can see are barely thought out ideas just to map possible ways to  
explore.
</p><p>
Any comments on the merit of any of these approaches?
</p></quote>

<p>There weren't any ideas concerning the integration with Linux apps.
It could be a cool project for someone looking to hook speech-to-text
into Linux apps though.</p>

<p>Rob then replied with an idea about his earlier thread concerning
multimonitor supoort:</p>
<quote who="Rob Done"><p>
So I could create 2 wine apps that simply duplicate the window creation and 
message handling , and have them use FindWindow and the like to enable 
using SendMessage and such to synchronize the windows?
</p><p>
If so, that would MUCH simpler than the method I had started formulating.
</p></quote>

<p>He replied to himself about four hours later:</p>
<quote who="Rob Done"><p>
I was going to wait til tomorrow to test this, but couldnt wait.
This works perfectly for my app and couldnt have came at a better time.
</p><p>
I just created a simple Win32 dispatcher program for each screen and sent 
the window creation messages to the HWNDs from FindWindow instead of the 
local app and it creates the dialogs on any screen I want. Joy Joy!!!!!
</p><p>
It worked out perfectly since the threads that create windows have to send 
messages to the main loop for it to create them so that the dialogs dont 
from close when the thread exits anyway.
</p><p>
It is refreshing that after I went through all the battles of getting 
multihead display, gcc, and wine running on Solaris that FINALLY something 
would work so simply.
</p><p>
Thanks again to the whole Wine crew that made this possible!!!
</p></quote>

</section>
<section 
	title="Killing Wine Processes"
	subject="killing wine dregs"
	archive="http://www.winehq.com/pipermail/wine-devel/2005-October/041796.html"
	posts="8"
>
<topic>Fixes</topic>
<mention>Walt Ogburn</mention>
<mention>Dan Kegel</mention>

<p>When apps hang it can be a pain to kill Wine.  Someone asked this
week about the merits of a particular method:</p>
<quote who="wino_at_piments.com"><p>
I often have wine finish uncleanly or need to break in if it is
misbehaving , this leaves some processes lying around and often means wine
cannot be restarted correctly.
</p><p>
I find killing it by hand labourious so I used the following command to
clean up and have now defined it as an alias to make life easier.

<ul><code>
pgrep wine|while read p; do kill -9 $p ; done;</code></ul>
</p><p>
It works nicely but just wondered if anyone would say OMG dont do that !
</p></quote>

<p>That launched a series of people describing their favorite methods for
killing off wine processes.  Walt Ogburn and Dan Kegel both suggested
using <tt>wineserver -k</tt>.  Mike McCormack suggested another way,
<quote who="Mike McCormack">


<tt>killall -9 wine-preloader</tt> works for me every time, however some older
kernels have a bug which causes zombie processes (a placeholder for the
process return code) to never be removed in the kernel.  I think this
was fixed around Linux 2.6.7 (ie. the unpatched Linux kernel).</quote></p>

<p>Francois Gouget explained another gotcha,
<quote who="Francois Gouget">

Besides the zombie processes mentionned before, some processes may be
stopped (e.g. by the debugger) and won't die until you send them a CONT
signal.</quote></p>
</section>
<section 
	title="Wine Eject"
	subject="New eject command issue"
	archive="http://www.winehq.com/pipermail/wine-devel/2005-November/041870.html"
	posts="10"
>
<topic>Multimedia</topic>
<p>Alexandre came up with a new Winelib helper utility: eject.  Not to be 
confused with the regular Linux eject command, it gets invoked by <tt>wine 
eject</tt>.  The idea remains the same though, to eject CD-ROMs.  It's 
particularly useful for things like multidisc installation programs.  
Christian Cost ran into problems using it:</p>

<quote who="Christian Costa"><p>

I tried to use the new eject command and this does not seem to work.
</p><p>
For that, I run a exe on the cdrom and try to eject the cdrom with:
<ul><code>
WINEDEBUG=+eject wine eject</code></ul>
</p><p>
and I get :
<ul><code>
trace:eject:eject_cd ejecting h:<br />
warn:eject:eject_cd IOCTL_STORAGE_MEDIA_REMOVAL failed with err 170<br />
warn:eject:eject_cd IOCTL_STORAGE_EJECT_MEDIA failed with err 170
</code></ul></p><p>
and nothing happen and files are still open on the cdrom as shown below :
<ul><code>
bash       1243   titan  cwd    DIR        0,8         0    219136 
/mnt/cdrom<br />
/mnt/cdrom wine-prel 14747   titan  mem    REG        0,8   2691072    219306 
/mnt/cdrom/DINO.exe</code></ul></p><p>

Is there anything particular to do ?
</p><p>
Morover,  it seems eject is not installed so I have to run from the 
programs directory.
I have also found that there is already a eject command in my distro 
(Mandrake).
So this conflict may require renaming the eject command.
</p><p>
Any idea ?
</p></quote>

<p>With regards to the last item, Alexandre explained,
<quote who="Alexandre Julliard">
Now you know why it's not installed. &lt;g&gt;  Just do 'wine eject'.
</quote></p>

<p>Alexandre guessed that Christian's CD-ROM hadn't been detected as a 
removable device.  He asked if it was a real CD or just a disk image.
Christian said it was a real CD-ROM and the appropriate entries in
~/.wine/dosdevices were correct.  Alexandre suggested,
<quote who="Alexandre Julliard">
You should set it to autodetect and check what GetDriveType returns
then. If it still returns CD-ROM then please send me a +server trace.
</quote></p>

<p>Christian reported the outcome of autodetect,
<quote who="Christian Costa">

If I set H: to autodetect, GetDriveType returns DRIVE_FIXED (3).</quote></p>

<p>Alexandre pointed to the next part of the chain,
<quote who="Alexandre Julliard">
Then you need to figure out why FILE_GetDeviceInfo doesn't recognize
it as a CDROM.</quote></p>

<p>After more investigation decided to hack it into working:</p>
<quote who="Christian Costa"><p>
I will hack FILE_GetDeviceInfo just to make it recognize my cdrom as removable
and try to see if it helps.
</p><p>
However, I don't understand well why forcing the drive as cdrom (instead of relying
on autodetection) is not taken into account. This could be also usefull for ISO images.
Unless this option is planned to be removed !?!

</p></quote>

<p>Alexandre explained why that was a bad idea,
<quote who="Alexandre Julliard">

We can't do that because all we have is a file handle, and there's no
way to know which drive it was opened from. Besides, you don't really
want that anyway, whether you open d:\foo or z:\mnt\cdrom\foo doesn't
change the fact that foo is on a removable device. So we really need
to make autodetection work properly (it does work fine for ISO images
BTW).
</quote></p>

<p>As I was covering this, I decided to try it out as well.  I ran into
the following problem:</p>
<quote who="Brian Vincent"><p>

Odd thing here as well.  Fedora Core 4.  This is wine CVS as of a few
days ago, I don't think anything has changed in this area.
</p><p>
If dosdevices contains a normal:
<ul><code>
lrwxrwxrwx  1 vinn vinn   18 Nov  5 15:37 d: -> /media/cdrecorder/
</code></ul></p><p>

Then "wine eject" doesn't work the first time I try it.  The second
time I run it, it works fine.
</p><p>
Debugging output shows this the first time I try it:
<ul><code>
[vinn@localhost dosdevices]$ WINEDEBUG=+eject wine eject
trace:eject:eject_cd ejecting d:<br />
warn:eject:eject_cd IOCTL_STORAGE_MEDIA_REMOVAL failed with err 170<br />
warn:eject:eject_cd IOCTL_STORAGE_EJECT_MEDIA failed with err 21
</code></ul></p><p>

Then the second time:
<ul><code>
[vinn@localhost dosdevices]$ WINEDEBUG=+eject wine eject<br />
trace:eject:eject_cd ejecting d:<br />
warn:eject:eject_cd IOCTL_STORAGE_MEDIA_REMOVAL failed with err 170
</code></ul></p></quote>

<p>Then I replied to myself,
<quote who="Brian Vincent">
Maybe I'm just unclear on the usage.  It appears the first time it
unmounts the drive and then the second time it actually ejects it.  Is
that intended behavior?</quote></p>

<p>There was no answer by the time this issue came out.</p>

</section>
<section 
	title="Linking Windows Libraries"
	subject="Calling PE DLLs"
	archive="http://www.winehq.com/pipermail/wine-devel/2005-November/041899.html"
	posts="5"
>
<topic>Winelib</topic>
<p>
A common reason for wanting to use Winelib is to take advantage
of proprietary Windows libraries and use them in a Winelib program to
interact natively on Linux.  One such example is audio codecs.
Daniel Stodden asked how to do something like that:</p>
<quote who="Daniel Stodden"><p>
I'm stuck at the process of loading PE dlls.
</p><p>
Like some others before me, i've got a native w32 dll which i
would like to hook into on a linux box. no source code available.
the case is almost identical to

<ul><a href="http://www.winehq.com/hypermail/wine-devel/2003/12/index.html#231">
http://www.winehq.com/hypermail/wine-devel/2003/12/index.html#231</a></ul>
</p><p>
though, there's not much application code yet, except a small test
program written by myself, currently only meant to call a single
function on the dll.
</p><p>
so, using winemaker does not seem to spit out anything usable, 
and there seems to be no official documentation on how to use 
winebuild here.
</p><p>
the program is called test.c, calling symbols from a vendor-supplied
header file.</p><p>
created test.o through winegcc:

<ul><code>winegcc -Wall -O2  -I.  -c -o test.o test.c
</code></ul>
</p><p>
let's call the library vendor.dll again.
i've played with winedump, finally got a vendor.dll.spec. 
</p><p>
i'm calling winebuild to get a .def as follows:

<ul><code>winebuild --def -E vendor.dll.spec -o libvendor.def
</code></ul>
</p><p>
then, one of my better guesses on how to proceed seemed to be:

<ul><code>winebuild --dll -fPIC -E vendor.dll.spec -L. -lvendor test.o -o
libvendor.dll.s
</code></ul>
</p><p>
the assembler code looks reasonable. though, linking fails with
duplicate symbols:

<ul><code>winegcc   test.o libvendor.dll.o  -o test
[..]
: multiple definition of `__wine_spec_nt_header'<br />

: multiple definition of `__wine_spec_file_name'<br />
</code></ul>


i'm aware that i could probably avoid all of this by just using
LoadLibrary() and resolving the symbols at runtime. otoh, the approach
above is potentially simpler, if i just knew how. :)
</p><p>
could someone please enlighten me? what am i doing wrong? 
</p></quote>

<p>Mike McCormack asked,
<quote who="Mike McCormack">

Why not just use LoadLibrary("vendor.dll") and GetProcAddress() in you 
winelib application instead of mucking round with winegcc and winebuild 
in order to directly link your dll?
</quote>
</p>
<p>Daniel said it was an option, but wanted to know how to get the method
he described to work:</p>
<quote who="Daniel Stodden"><p>
you're right. as i said, that's an obvious option. 
</p><p>
but since linking directly would work on windows and since
the .def-mechanism with wine tools is supposed to support just that, and
since, for the purpose in question, i really don't see the point in
programming the dynamic loader manually, why not give it a try as well?
</p><p>
but basically you're right.

</p></quote>

<p>Alexandre replied:</p>
<quote who="Alexandre Julliard"><p>
Once you have libvendor.def you should
be able to simply do:
<ul><code>
  winegcc -o test test.o -lvendor</code></ul></p></quote>

<p>Daniel replied that it worked and the runtime loading method did as well.</p>

</section></kc>
