Mark Harris
2015-Aug-07 08:25 UTC
[opus] [PATCH] Fix const struct to work with C++ compilation
This allows the libopus source files to be compiled with a C++ compiler, by ensuring that the "extern const MLP net" declaration is visible at the point of the "const MLP net" in src/mlp_data.c. Otherwise it will default to static linkage in C++, resulting in an undefined symbol. Note that if compiled with a C++ compiler the symbols will be mangled, so don't do that if you want to be able to call it from C code or run the tests (which still require a C compiler). --- src/analysis.c | 2 -- src/mlp.h | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/analysis.c b/src/analysis.c index 2ee8533..401a43e 100644 --- a/src/analysis.c +++ b/src/analysis.c @@ -39,8 +39,6 @@ #include "mlp.h" #include "stack_alloc.h" -extern const MLP net; - #ifndef M_PI #define M_PI 3.141592653 #endif diff --git a/src/mlp.h b/src/mlp.h index 053b23b..618e246 100644 --- a/src/mlp.h +++ b/src/mlp.h @@ -36,6 +36,8 @@ typedef struct { const float *weights; } MLP; +extern const MLP net; + void mlp_process(const MLP *m, const float *in, float *out); #endif /* _MLP_H_ */ -- 2.4.5
Reasonably Related Threads
- Help building OPUS library using FIXED_POINT option
- MSVC compatibility patch for current master branch
- Help building OPUS library using FIXED_POINT option
- opus-1.3.1 patch for ARM Cortex-M4F (single precision)
- [RFC PATCH v1 2/2] armv7(float): Optimize encode usecase using NE10 library