<br><br><div><span class="gmail_quote">2007/8/20, Damjan Jovanovic <<a href="mailto:damjan.jov@gmail.com">damjan.jov@gmail.com</a>>:</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 <<a href="mailto:trulyliu@gmail.com">trulyliu@gmail.com</a>> wrote:<br>> hi:<br>><br>> I am sorry to disturb you with a question about calling PE Dll on linux.<br>> This is really an old question.
<br>> I found the sameness issues in mail list.<br>><br>> <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>
> <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>> <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>> <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>><br>> I have tried the ways discussed in these threads��<br>> But it's not clear enough how to do this.<br>> So I send this mail to you for some help.<br>><br>> I have a PE Dll named Arithmetic.dll
which exports a function,<br>> it's prototype is:<br>> void sort(unsigned int*, int num)<br>><br>> I want to call the function in my Linux App.<br><br>You can't, it'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>> I used winedump to generate a spec file<br>><br>> winedump spec
Arithmetic.dll<br>><br>> This comand generated three files: Arithmetic_dll.h Arithmetic_main.c and<br>> Arithmeticspec.<br>> What's the next exactly step I should do?<br>> What's the usage of the three files?
<br>> And wow could I use them?<br><br>#include <windows.h><br><br>int main(int argc, char **argv)<br>{<br> HANDLE h;<br> void (/*WINAPI?*/ *sort)(unsigned int,int);<br> unsigned int *nums = malloc(sizeof(unsigned int) * 4);
<br> nums[0] = 3;<br> nums[1] = 2;<br> nums[2] = 1;<br> nums[3] = 0;<br> h = LoadLibrary("Arithmetic.dll");<br> sort = GetProcAddress(h, "sort");<br> 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's complier�� What'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;">><br>> I made reference to mplayer's implementation,<br>> It's code is a little clutter�� and I don't have experience on MS D-Show.
<br>> Could you give me some simple sample codes ??<br><br>MPlayer's code is GPL, so if you use it your code will be GPL too.<br><br>> Best Regards.<br>><br>> --<br>> <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>