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