On Tuesday 18 July 2006 16:28, Ge van Geldorp wrote:
It's an intriguing idea, but I can't see how it could work for even slightly complex cases. Take the COM calls. When the COM object is constructed, you have absolutely no idea whether its methods are going to be called from a Wine or from a PE environment.
No, but if an interface pointer to it is being made known to another part of the system then this will be done through some API call that will have to be (made) aware of which calling convention has been used to provide the pointer (or which is a more complex thunk). Internally if it came from a PE context, it would need to create a new pointer that would be to an object created based on the IDL for the interface, the new pointer being something using the host calling convention that passes all calls on to the original interface (essentially, more thunks).
It might be useful for the newly created object to have a WINE-specific interface available for querying whether it is a thunk and identifying the original pointer so that when passing the pointer back to a PE context we can just pass the original pointer (rather than creating a new Win64 calling convention object that directs back to the host calling convention object which in turn directs back to another Win64 calling convention object).
The complexity of this is such that most of it would have to be done by writing code generators rather than by writing the code directly, however the languages that would be inputs to the code generators are largely already defined (IDL and Wine's spec files).
No doubt it would be easier to wait for gcc to support the Win64 calling convention, but that is not the only option.