<br><br><div><span class="gmail_quote">2007/8/20, Damjan Jovanovic &lt;<a href="mailto:damjan.jov@gmail.com">damjan.jov@gmail.com</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On 8/20/07, trulyliu &lt;<a href="mailto:trulyliu@gmail.com">trulyliu@gmail.com</a>&gt; wrote:<br>&gt; hi:<br>&gt;<br>&gt; I am sorry to disturb you with a question about calling PE Dll on linux.<br>&gt; This is really an old question.
<br>&gt; I found the sameness issues in mail list.<br>&gt;<br>&gt; <a href="http://www.winehq.org/pipermail/wine-devel/2003-December/thread.html">http://www.winehq.org/pipermail/wine-devel/2003-December/thread.html</a><br>
&gt; <a href="http://www.winehq.org/pipermail/wine-devel/2005-November/thread.html#41917">http://www.winehq.org/pipermail/wine-devel/2005-November/thread.html#41917</a><br>&gt; <a href="http://www.winehq.org/pipermail/wine-users/2004-August/014685.html">
http://www.winehq.org/pipermail/wine-users/2004-August/014685.html</a><br>&gt; <a href="http://www.winehq.org/pipermail/wine-devel/2006-August/050619.html">http://www.winehq.org/pipermail/wine-devel/2006-August/050619.html
</a><br>&gt;<br>&gt; I have tried the ways discussed in these threads��<br>&gt; But it&#39;s not clear enough how to do this.<br>&gt; So I send this mail to you for some help.<br>&gt;<br>&gt; I have a PE Dll named Arithmetic.dll
 which exports a function,<br>&gt; it&#39;s prototype is:<br>&gt; void sort(unsigned int*, int num)<br>&gt;<br>&gt; I want to call the function in my Linux App.<br><br>You can&#39;t, it&#39;s not supported (yet), but what you want is the Wine
<br>plugin API (<a href="http://wiki.winehq.org/WinePluginApi">http://wiki.winehq.org/WinePluginApi</a>).<br><br>At the moment you have 2 options:<br>* Make a Windows application instead of a Linux application.<br>* Make a winelib application which will require wine to run but can
<br>access Linux libraries as well (with some restrictions, eg. you have<br>to use Windows synchronization primitives instead of the pthreads<br>ones).<br><br>&gt; I used winedump to generate a spec file<br>&gt;<br>&gt; winedump spec 
Arithmetic.dll<br>&gt;<br>&gt; This comand generated three files: Arithmetic_dll.h Arithmetic_main.c and<br>&gt; Arithmeticspec.<br>&gt; What&#39;s the next exactly step I should do?<br>&gt; What&#39;s the usage of the three files?
<br>&gt; And wow could I use them?<br><br>#include &lt;windows.h&gt;<br><br>int main(int argc, char **argv)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp; HANDLE h;<br>&nbsp;&nbsp;&nbsp;&nbsp; void (/*WINAPI?*/ *sort)(unsigned int,int);<br>&nbsp;&nbsp;&nbsp;&nbsp; unsigned int *nums = malloc(sizeof(unsigned int) * 4);
<br>&nbsp;&nbsp;&nbsp;&nbsp; nums[0] = 3;<br>&nbsp;&nbsp;&nbsp;&nbsp; nums[1] = 2;<br>&nbsp;&nbsp;&nbsp;&nbsp; nums[2] = 1;<br>&nbsp;&nbsp;&nbsp;&nbsp; nums[3] = 0;<br>&nbsp;&nbsp;&nbsp;&nbsp; h = LoadLibrary(&quot;Arithmetic.dll&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp; sort = GetProcAddress(h, &quot;sort&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp; sort(nums, 4);<br>}<br>
<br>winegcc main.c -o main<br>./main</blockquote><div><br><br>I have tried these code, It works well. Thanks a lot.<br>Could I use gcc/g++ instead of winegcc/wineg++ ???<br>mplayer use gcc as it&#39;s complier�� What&#39;s the mystery in it?
<br><br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">&gt;<br>&gt; I made reference to mplayer&#39;s implementation,<br>&gt; It&#39;s code is a little clutter�� and I don&#39;t have experience on MS D-Show.
<br>&gt; Could you give me some simple sample codes ??<br><br>MPlayer&#39;s code is GPL, so if you use it your code will be GPL too.<br><br>&gt; Best Regards.<br>&gt;<br>&gt; --<br>&gt; <a href="mailto:trulyliu@gmail.com">
trulyliu@gmail.com</a><br><br>Good luck<br>Damjan<br><br><br></blockquote></div><br><br clear="all"><br>-- <br><a href="mailto:trulyliu@gmail.com">trulyliu@gmail.com</a><br>