One more try using winebuild

Questions about Wine on Linux
Locked
mqguy
Level 1
Level 1
Posts: 7
Joined: Wed Sep 18, 2013 11:02 am

One more try using winebuild

Post by mqguy »

I thought I'd have one more try at trying to build my simple shared library using winebuild before giving up on
wine completely and just use Windows. I'm sure the problem is the truly awful documentation that covers programs
such as winebuild, winemaker and winegcc. Some simple examples which show each of the stages would work wonders.

This is my make file....

ccopts= -m32 -fPIC -c -I/usr/include/wine/windows -I/opt/mqm/inc
ldopts= -m32 -fPIC -shared -L/usr/lib/wine -L/opt/mqm/lib -lmqic_r


all: mqic32.dll.so

mqic32.o: mqic32.c
cc $(ccopts) -o mqic32.o mqic32.c

mqic32.dll.o: mqic32.dll.spec
winebuild --dll -m32 -E ./mqic32.dll.spec -o mqic32.dll.o

mqic32.dll.so: mqic32.o mqic32.dll.o
winegcc $(ldopts) -z muldefs -o mqic32.dll.so mqic32.o mqic32.dll.o



This does generate a mqic32.dll.so shared library which my Windows EXE successfully loads. However,
no matter what I try the GetProcAddress() call consistently fails. Can anyone tell me how I am supposed to dynamically call this stuff?

Any help would be appreciated, I am tearing my hair out here.
User avatar
DanKegel
Moderator
Moderator
Posts: 1164
Joined: Wed May 14, 2008 11:44 am

Re: One more try using winebuild

Post by DanKegel »

For what it's worth, there's no particular reason to use winebuild for user apps.
You're better off using mingw, I think.

See e.g. http://www.mingw.org/wiki/sampleDLL
On Ubuntu, here's how to build that:

sudo apt-get install mingw-w64
i586-mingw32msvc-g++ -c -DBUILDING_EXAMPLE_DLL example_dll.cpp
i586-mingw32msvc-g++ -shared -o example_dll.dll example_dll.o -Wl,--out-implib,libexample_dll.a

The nice thing about this approach is that it works identically
whether building on linux or on windows.
Hope that helps!
mqguy
Level 1
Level 1
Posts: 7
Joined: Wed Sep 18, 2013 11:02 am

Re: One more try using winebuild

Post by mqguy »

Thanks for your reply but now I'm even more confused.

I have a Windows application, the full EXE which I want to run under WINE.
This program runs just fine but to do certain things it loads an application DLL.
For various reasons it is not feasible for me to have it load and run the Windows DLL.
Instead I want to build a DLL which it can load which will call the equivalent function in a Linux shared library.

So, is MinGW really the right tool for this? Why does all the WINE documentation seem to go on about winebuild?

I have to say that I find the documentation around wine very, very poor. I am fairly new to Unix although not at all new to programming and the standard of information around this area I find shockingly bad. I'm amazed that anyone uses it although I am beginning to get the feeling that actually, no one really does.
Locked