On 2 Jan 2001, Alexandre Julliard wrote:
> Francois Gouget <[EMAIL PROTECTED]> writes:
>
> > Here's the testcase I wrote:
> >
> > #define GetObject You cannot use GetObject in this context
> >
> > #define ICOM_FN(xfn) fn ## xfn
> >
> > #define DECLARE1(xfn) void ICOM_FN(xfn) (void);
> > #define DECLARE2(xfn) void ICOM_FN(##xfn) (void);
>
> If the only problem is GetObject and similar functions, couldn't we
> simply #undef GetObject and get rid of ICOM_FN completely? or is there
> a deeper issue?
AFAICS there's two aspects:
- the fn prefix in Wine is there to avoid trouble with the GetObject and
GetClassInfo defines.
- a number of files (e.g. DirectX stuff) put in the fn prefix by
hand. Mostly in cases where take the address of the function (to
initialize the virtual tables mostly). E.g.:
# define XCAST(fun) (typeof(dga_ddvt.fn##fun))
K32WOWCallback16Ex(
(DWORD)((ICOM_VTABLE(IMalloc16)*)MapSL(
(SEGPTR)ICOM_VTBL(((LPMALLOC16)MapSL((SEGPTR)mllc))))
)->fnAlloc,
WCB16_CDECL,
2*sizeof(DWORD),
(LPVOID)args,
(LPDWORD)idstr
)
So if we undef GetObject and GetClassInfo (plus potentially others in
the future), we could remove the 'fn' prefix but it would take work to
update the code.
On the gcc mailing list Alexandre Oliva and Neil Booth suggested a
solution that involves using vararg macros.
#define ICOM_VMETHOD(xfn,dummy...) \
void CALLBACK (*ICOM_FN(xfn##dummy))(ICOM_INTERFACE* me);
The problem is the above only works with gcc.
So I propose instead to go back a little bit and simply duplicate the
ICOM_METHOD macros as needed. At least this should work just fine on
about any compiler.
* diff20010103-obj_base1.txt
-> This patch implements the varargs macro solution
* diff20010103-obj_base2.txt
-> This patch duplicates the ICOM_METHOD macros to put or not a
prefix.
--
Francois Gouget [EMAIL PROTECTED] http://fgouget.free.fr/
Dieu dit: "M-x Lumière". Et la lumière fut.