How to deal with C++ APIs in wine spec file

Jia L Wu jwu at
Wed Oct 6 05:53:33 CDT 2004

Actually I have the source code for the dll. Because a lot of classes
in that dll are implemented in inline assembly for VC compiler and inline
assembly sytax difference between vc and gcc, i thought the simple way is
to use wine (winelib)  and just call class methods of the dll when they
are needed in other part of code (which is built as linux native).

I don't know much about wine, so could you provide me more detailed
description with an example on how this can be done? Thanks.


On Fri, 1 Oct 2004, Jon Griffiths wrote:

> Hi,
> > I think the original poster wanted to use a closed-source
> > third-party DLL
> > written in C++ and compiled with MSVC.  AFAIK none of your
> > suggestions address that case.
> If source for the dll isn't available then the only option i can
> think of is as follows:
> WARNING: Untested, but should work(tm). its a lot of effort however.
> Take the header(s) for the dll and compile them into a winelib dll as
> per previous instructions, method 3. You will need to write dummy
> code for each object method. Add to the implementation of each class
> a pointer to the real class in the native dll. In each dummy method
> proxy the call to the real dll, using GetProcAddress and passing the
> real class pointer using the msvcrt convention (this = %ecx, ). If a
> class has public members, update them from the object pointer before
> returning.
> See dlls/msvcrt/tests/cpp.c for an example of calling native C++
> object methods from Wine and accessing object members.
> Link with the modified dll as per method 3 and all calls should go to
> the native dll.
> If you try this let me know how you get on. I've been mulling the
> possibility of automatically creating thunks like this for a couple
> of years now.
> Hope this helps,
> Jon
> =====
> "Don't wait for the seas to part, or messiahs to come;
>  Don't you sit around and waste this chance..." - Live
> jon_p_griffiths at
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - Send 10MB messages!

More information about the wine-devel mailing list