Runtime error with winelib and CreateMutex()

Jerry Thomas jto at consegna.co.uk
Thu Apr 19 11:44:25 CDT 2001


lawson_whitney at juno.com wrote:

> On Wed, 18 Apr 2001, Jerry Thomas wrote:
>
> > Can't find anything at goggle, so hope someone in this group can help.
> >
> > I've installed codeweavers-wine-20010305-1.i386.rpm on my RedHat 7.0,
> > which put everything in /opt/wine/.
> > I built the following program (in file hello.cpp):
> >
> > #include <iostream.h>
> > #include <windows.h>
> >
> > int main()
> > {
> >    INT i = 0;
> >    cout << "i = " << i << endl;
> >
> >    HANDLE h = CreateMutex(0, FALSE, "h");
> >
> >    return 0;
> > }
> >
> > compiling with:
> >
> > g++ -o hello -I/opt/wine/include/wine -L/opt/wine/lib -lkernel32
> > hello.cpp
> >
> > When the executable 'hello' is run, the following is output:
> >
> > i = 0
> > wine client error:(nil):  buffer overflow 16 bytes
> >
> > Anyone know why the line initializing variable h is causing this error?
>
> It isn't.  You can't just link a program to a wine dll and expect it to
> work.  You must import the dlls you want in a .spec file and use
> winebuild to generate the - glue code? - to hold it together.  The
> easiest way I know to do it is just to use winemaker on it, since it
> knows better than I how to work winelib.  My wine is in /usr/local/lib
> where it belongs :-) and I always have to hack that into the
> Makefile winemaker generates - setting
>
> WINE_LIBRARY_PATH = -L/usr/local/lib
>
> works for me.  If you must use c++, I guess you will have to hack the
> actual entry point for the thing into the spec file.  When I named it
> WinMain, all I could find in the object was WinMain__Fv, so I used that.

Thanks for that.  I've tried using 'winemaker --console' and 'configure',
and
running make compiles the source files and then runs winebuild successfully.

But the final step is to produce a .so file (g++ -shared ...), and the only
executable produced is
a soft link to /usr/bin/wine.  Is there any way to get it to produce an
executable?
Using the --cuiexe flag with winemaker give the same result.

>
>
> >
> > thanks in advance,
> >
> > Jerry
> Script started on Wed Apr 18 21:57:47 2001
> [whit at giftie hello]$ ./hello
> i = 0
> [whit at giftie hello]$ exit
> exit
>
> Script done on Wed Apr 18 21:58:02 2001
>
> If you build it right, you don't get that error, but I can't see that it
> does anything useful.

>
>
> Lawson
>
> This message is brought to you by Wine-20010326, junopine-2.0.2,
> Juno 2.0.11, pine-4.10, and linux-2.4.3.
> ---cut here
>
> ________________________________________________________________
> GET INTERNET ACCESS FROM JUNO!
> Juno offers FREE or PREMIUM Internet access for less!
> Join Juno today!  For your FREE software, visit:
> http://dl.www.juno.com/get/tagj.




More information about the wine-users mailing list