[vorbis-dev] win32sdk shared memory issue -- proposed change of code

Chris Wolf cwolf at starclass.com
Wed Oct 17 11:00:38 PDT 2001



It was recently brought to my attention by "Ram'on Garc'ia Fern'andez <ramon at jl1.quim.ucm.es>"
that there is yet an even simpler solution to the issue of cross-DLL access of variables in the data segment.

Although a variable may be exported either from the module definition file, or explicitly
via _cdeclspec(dllexport) -- unlike procedures (functions), it is mandatory for a DLL
client to access that variable via _cdeclspec(dllimport).

It is unnecessary to allocate dynamic memory and then copy pointers 
to that allocated memory, as is done with the vorbis/win32/src/shmmap.h and 
vorbis/win32/src/shmmap_c.h stuff.

In otherwords, we've come full circle -- it looks like the linking paradigm in Windows 
is closer to what would be expected when developing under UNIX, after all...

...well -- almost, as mentioned, the "_cdeclspec(dllimport)" attribute is required, such that
a modification of "vorbis/lib/registry.h" is required which would look like:

#if defined(_MSC_VER) && defined(DLL_IMPORT)
# define EXTERN _declspec(dllimport) extern
#else
# define EXTERN extern
#endif

EXTERN vorbis_func_time      *_time_P[];
EXTERN vorbis_func_floor     *_floor_P[];
EXTERN vorbis_func_residue   *_residue_P[];
EXTERN vorbis_func_mapping   *_mapping_P[];

I realize the aesthetics of having "EXTERN" instead of "extern" may be an issue on
non-win32 platforms, (although in this case it would still preprocess out to "extern")
so I thought I'd present the proposed change to the list before commiting to CVS...

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis-dev mailing list