[vorbis] problem with Vorbis DLL's
John Lundy
jlundy at playnet.com
Tue Feb 12 20:28:50 PST 2002
I'm glad this topic has come up. I wanted to do a dynamic link of the ogg
DLLs with RipTrax. I felt this was mandatory to allow users the option of
what encoder(s) and DLLs they chose to use. Two issues need to be addressed
formally (by the dev group; I guess) in order to make dynamic linking
someting other than a hack.
First, the header files do not have any structure member alignment specified
(or bounding) the structures. So, if you want to use the prebuilt DLLs, you
will need to set your whole project's alignment to be 8 bytes. Better would
be a set of #pragma statements bounding the structures so that the project
can have an independent alignment to that required of the DLLs.
Second, all the functions need to have typedef prototypes defined. Also,
some method (a #define with an #if #else #endif form) that the coder can use
to indicate to the headers that the build is a static (LIB file linking) or
dynamic (LoadLibrary) build.
I had to implement a hacked set of header files to successfully integrate a
dynamic linkage. Of course, all of this will have to be redone when the next
version of ogg is released. That is, unless the dev team decides to help us
users out in this area. :)
Some credit is certainly due to the ogg crew, however. Once I made the
header changes and set the alignment to 8 bytes in my project, ogg just
worked. And worked very well indeed!
John
----- Original Message -----
From: "Brent Phillips" <brent at lyrastudios.com>
To: <vorbis at xiph.org>
Sent: Tuesday, February 12, 2002 6:54 PM
Subject: [vorbis] problem with Vorbis DLL's
<p>> Hi,
>
> I was wondering if anyone out there had any success dynamically loading
the
> Vorbis libraries via LoadLibrary on Win32. I'm able to use things
properly
> by linking in the static libraries, but when I try to load them
dynamically
> (which I really need to do), I get an access violation when calling
ov_open.
>
> The code looks something like this...
>
> typedef int (*OVOPEN)(FILE*,OggVorbis_File*,char*,long);
> HMODULE hVorbisFile;
> OVOPEN hOvOpen;
>
> hVorbisFile = LoadLibrary(_T("Vorbisfile.DLL"));
> hOvOpen = (OVOPEN)GetProcAddress(hVorbisFile, _T("ov_open"));
>
> sprintf(filename, "music\\Track%02d.OGG", track_number);
> vorbis_fd = fopen(filename, _T("rb"));
> _setmode( _fileno( vorbis_fd ), _O_BINARY );
> if ((hOvOpen)(vorbis_fd, &vf, NULL, 0) < 0) {
>
> then POOF!
>
>
> thanks!
>
> Brent
>
>
> --- >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-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.
>
>
<p>--- >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-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
mailing list