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

Jon Griffiths jon_p_griffiths at yahoo.com
Fri Oct 1 10:25:09 CDT 2004


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 yahoo.com


		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 



More information about the wine-devel mailing list