Solaris/linker: static symbols in pr-output.cc undefined

John W. Eaton jwe at bevo.che.wisc.edu
Mon Dec 3 16:55:02 CST 2007


On 29-Nov-2007, Moritz Borgmann wrote:

| There's some additional complication with the static 
| permute_vector_compare in Array.cc (it's another static symbol that's 
| affected by the issue at hand). Since Array.cc gets #included in a 
| lot of places, we can't simply strip the "static"; this would lead to 
| multiply-defined symbols. My solution is to pull the thing out of 
| Array.cc and move it into Array-util.cc:
| 
| Index: liboctave/Array-util.cc
| ===================================================================
| RCS file: /cvs/octave/liboctave/Array-util.cc,v
| retrieving revision 1.19
| diff -u -r1.19 Array-util.cc
| --- liboctave/Array-util.cc     12 Oct 2007 21:27:13 -0000      1.19
| +++ liboctave/Array-util.cc     29 Nov 2007 15:19:01 -0000
| @@ -28,6 +28,16 @@
|   #include "dim-vector.h"
|   #include "lo-error.h"
| 
| +int
| +permute_vector_compare (const void *a, const void *b)
| +{
| +  const permute_vector *pva = static_cast<const permute_vector *> (a);
| +  const permute_vector *pvb = static_cast<const permute_vector *> (b);
| +
| +  return pva->pidx > pvb->pidx;
| +}
| +
| +
|   bool
|   index_in_bounds (const Array<octave_idx_type>& ra_idx, const 
| dim_vector& dimensions)
|   {
| Index: liboctave/Array-util.h
| ===================================================================
| RCS file: /cvs/octave/liboctave/Array-util.h,v
| retrieving revision 1.11
| diff -u -r1.11 Array-util.h
| --- liboctave/Array-util.h      12 Oct 2007 21:27:13 -0000      1.11
| +++ liboctave/Array-util.h      29 Nov 2007 15:19:01 -0000
| @@ -30,6 +30,15 @@
|   #include "idx-vector.h"
|   #include "lo-error.h"
| 
| +struct
| +permute_vector
| +{
| +  octave_idx_type pidx;
| +  octave_idx_type iidx;
| +};
| +
| +int permute_vector_compare (const void *a, const void *b);
| +
|   extern OCTAVE_API bool index_in_bounds (const Array<octave_idx_type>& ra_idx,
|                               const dim_vector& dimensions);
| 
| Index: liboctave/Array.cc
| ===================================================================
| RCS file: /cvs/octave/liboctave/Array.cc,v
| retrieving revision 1.165
| diff -u -r1.165 Array.cc
| --- liboctave/Array.cc  26 Nov 2007 20:42:09 -0000      1.165
| +++ liboctave/Array.cc  29 Nov 2007 15:19:01 -0000
| @@ -401,21 +402,7 @@
|     return retval;
|   }
| 
| -struct
| -permute_vector
| -{
| -  octave_idx_type pidx;
| -  octave_idx_type iidx;
| -};
| 
| -static int
| -permute_vector_compare (const void *a, const void *b)
| -{
| -  const permute_vector *pva = static_cast<const permute_vector *> (a);
| -  const permute_vector *pvb = static_cast<const permute_vector *> (b);
| -
| -  return pva->pidx > pvb->pidx;
| -}
| 
|   template <class T>
|   Array<T>

OK, for now I made this change, but I think that in the future, we
should maybe try to eliminate the functions in Array-util.cc or hide
them inside the Array class.

jwe


More information about the Bug-octave mailing list