From 16242a0384d2d967b71c5f85f70791a3a80f972c Mon Sep 17 00:00:00 2001 From: Mike Smith Date: Fri, 21 Apr 2006 17:59:10 +0000 Subject: [PATCH] Document ov_open() unsafeness on win32 when dynamically linked. svn path=/trunk/vorbis/; revision=11210 --- doc/vorbisfile/ov_open.html | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/doc/vorbisfile/ov_open.html b/doc/vorbisfile/ov_open.html index ba53031..4494053 100644 --- a/doc/vorbisfile/ov_open.html +++ b/doc/vorbisfile/ov_open.html @@ -97,6 +97,23 @@ which may require reading large parts of the file under certain circumstances (determining all the logical bitstreams in one physical bitstream, for example). See Thread Safety for other information on using libvorbisfile with threads. +

WARNING for windows developers: this function cannot be used on win32 if your application dynamically links to libvorbisfile (see this microsoft page for details of why). Instead, you must use ov_open_callbacks(). A simple set of callbacks that will work is: +

+  static int _fseek64_wrap(FILE *f,ogg_int64_t off,int whence){
+    if(f==NULL)return(-1);
+    return fseek(f,off,whence);
+  }
+
+  ov_callbacks callbacks = {
+    (size_t (*)(void *, size_t, size_t, void *))  fread,
+    (int (*)(void *, ogg_int64_t, int))           _fseek64_wrap,
+    (int (*)(void *))                             fclose,
+    (long (*)(void *))                            ftell
+  };
+
+
+

+




-- 2.7.4