Release 951124
[wine/multimedia.git] / toolkit / README.libres
blob880272f3a01e1c5cce16360a72aa88721840edca
1                         WINElib resources: a proposal
3 One of the current issues with WINElib is the inadequate support for accessing
4 resources by name.  I propose the following technique (which I have already
5 begun to implement) to allow this:
7    An internal table of resource entries is provided along with a registering
8    function for adding a resource to this table.  'winerc' should construct
9    *.c files much the same way as it does now with the inclusion of a single
10    static 'constructor' function that registers the associated resources with
11    the internal mechanism like so:
13       static void DoIt() __attribute__ ((constructor));
14       static void DoIt()
15       {
16         LIBRES_RegisterResource(hello3_MENU_MAIN__bytes,
17                                 sizeof(hello3_MENU_MAIN__bytes),
18                                 "MAIN",
19                                 RT_MENU);
20         LIBRES_RegisterResource(hello3_DIALOG_DIADEMO__bytes,
21                                 sizeof(hello3_DIALOG_DIADEMO__bytes),
22                                 "DIADEMO",
23                                 RT_DIALOG);
24            ... etc. ...
25       }
27    The internal table can then be searched for the resource by name.
29 The only potential drawback I've determined so far is this technique's
30 reliance on gcc's 'constructor' attribute, which disallows compilation with
31 some other compiler.  However, I'm guessing that WINE is already heavily
32 dependent on gcc, so this is probably not too much of a factor.
34 Any comments/suggestions/criticisms will be greatly appreciated.
36 Thank you,
37 --Jim