[vorbis-dev] win32sdk shared memory issue

Chris Wolf cwolf at starclass.com
Mon Oct 8 22:22:31 PDT 2001



The #pragma data_seg trick definitely doesn't work now.  I was told that it used to work with
Windows NT 3.1.  I tried it anyway as exactly as that article mentions, as the 
first attempt at a solution, before arriving at what is there now, and it didn't work.

The other way around it 
is to use file-mapped shared memory segments; the "shmmap*" files were 
part of that solution, which did work (hence the file names.)  I then discovered that as 
long as the memory was dynamically allocated, as opposed to
statically allocated/declared, then the function pointers could
be copied, so I was able to actually get rid of the file-mapped shared memory
mechanism.  Since these are function pointers, they point to locations
in the text segment, so it works.  If they were pointers into the data segment
(i.e. globals) then we would be forced to bring back the file-mapped shared
memory mechanism.  There was a LOT of discussion regarding this issue, and
you want, you can search the archives to see that this solution was not arrived at
haphazardly.  Thanks for the suggestion, though.  
Linking under windows is certainly an interesting and challenging puzzle.

On 10/9/2001 at 1:23 AM Michael Smith wrote:

>At 05:05 PM 10/8/01 +0200, you wrote:
>>Hi vorbis-devs,
>>
>>I use the Ogg Vorbis libraries built from the win32sdk in winlame. Since
>the 
>>rc2 DLL's are not functioning, I compiled them by myself. The apparent
>reason 
>>is that some data arrays like _residue_P were not shared among DLLs.
>>
>>I looked at the code, and found that IMHO dirty hack in 
>>vorbis/win32/src/shmmap*.h that maps the data arrays.
>>
>>Why not placing the data arrays in shared segments? 
>>http://support.microsoft.com/support/kb/articles/Q100/6/34.ASP is a good 
>>description how to achieve that. Just some #pragma's that could go into
>#if 
>>defined(_MSC_VER) sections.
>
>Yes, this way of doing things is stupid and horrible. Apparently, however,
>it is neccesary. Blame microsoft. I believe (having not tested this, I
>can't
>say whether it is true or not) that this approach was tried, and does not
>correctly work under some versions of windows (NT5, for example).
>
>The URL you cited supports the suggestion that this technique may randomly
>fail to work depending on what else is linked into the program, and/or the
>current phase of the moon (well, not really). Thus the ugly hack you see.
>
>I think the current plan (possibly not implemented yet, I haven't looked)
>is to replace the shared memory segments by simple memory allocations 
>(strangely, this is apparently sufficient). 
>
>Michael
>
>
>--- >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.

--- >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