Fix access violation for win32 vorbisenc
authorcwolf <cwolf@xiph.org>
Fri, 7 Sep 2001 08:42:30 +0000 (08:42 +0000)
committercwolf <cwolf@xiph.org>
Fri, 7 Sep 2001 08:42:30 +0000 (08:42 +0000)
svn path=/trunk/vorbis/; revision=1982

lib/registry.c
lib/vorbisenc.c

index b8a5d51..a96e2b8 100644 (file)
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: registry for time, floor, res backends and channel mappings
- last mod: $Id: registry.c,v 1.9 2001/08/13 01:36:57 xiphmont Exp $
+ last mod: $Id: registry.c,v 1.10 2001/09/07 08:42:30 cwolf Exp $
 
  ********************************************************************/
 
@@ -20,6 +20,7 @@
 #include "registry.h"
 #include "misc.h"
 
+
 /* seems like major overkill now; the backend numbers will grow into
    the infrastructure soon enough */
 
@@ -50,3 +51,11 @@ vorbis_func_mapping   *_mapping_P[]={
   &mapping0_exportbundle,
 };
 
+  /*
+   * For win32 only, the following code needs to be appended to this file 
+   * because the "sizeof" operator can only evaluate the sizes
+   * of statically initialized arrays in the same compilation unit.
+   */ 
+#if defined(_MSC_VER) && defined(STANDALONE_VORBISENC_DLL)
+# include "shmmap_c.h"
+#endif
index da36ac4..8d16bdc 100644 (file)
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: simple programmatic interface for encoder mode setup
- last mod: $Id: vorbisenc.c,v 1.14 2001/09/01 06:14:50 xiphmont Exp $
+ last mod: $Id: vorbisenc.c,v 1.15 2001/09/07 08:42:30 cwolf Exp $
 
  ********************************************************************/
 
 #include "os.h"
 #include "misc.h"
 
+/*
+ * If this module gets built into a separate shared library 
+ * on win32 (DLL), then the backend mappings from registry.c
+ * need to be referenced from a file-mapped shared memory segment.
+ */
+#if defined(_MSC_VER) && defined(STANDALONE_VORBISENC_DLL)
+# include "shmmap.h"
+
+# define _time_P    g_shared_map->p_time_P
+# define _floor_P   g_shared_map->p_floor_P
+# define _residue_P g_shared_map->p_residue_P
+# define _mapping_P g_shared_map->p_mapping_P
+#endif
 
 /* deepcopy all but the codebooks; in this usage, they're static
    (don't copy as they could be big) */