ref: 7f38906f5073e40362bd4d3ce8932378dc9818aa
parent: 31b79d19932ce37c62b4aed8cee2180e6106a25c
author: Jean-Marc Valin <[email protected]>
date: Wed Mar 12 13:46:04 EDT 2008
Added info for properly exporting symbols
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -78,7 +78,7 @@
celt_word16_t *oldBandE;
};
-CELTEncoder *celt_encoder_create(const CELTMode *mode)
+CELTEncoder EXPORT *celt_encoder_create(const CELTMode *mode)
{
int N, B, C;
CELTEncoder *st;
@@ -114,7 +114,7 @@
return st;
}
-void celt_encoder_destroy(CELTEncoder *st)
+void EXPORT celt_encoder_destroy(CELTEncoder *st)
{
if (st == NULL)
{
@@ -231,7 +231,7 @@
RESTORE_STACK;
}
-int celt_encode(CELTEncoder *st, celt_int16_t *pcm, unsigned char *compressed, int nbCompressedBytes)
+int EXPORT celt_encode(CELTEncoder *st, celt_int16_t *pcm, unsigned char *compressed, int nbCompressedBytes)
{
int i, c, N, B, C, N4;
int has_pitch;
@@ -454,7 +454,7 @@
int last_pitch_index;
};
-CELTDecoder *celt_decoder_create(const CELTMode *mode)
+CELTDecoder EXPORT *celt_decoder_create(const CELTMode *mode)
{
int N, B, C;
CELTDecoder *st;
@@ -484,7 +484,7 @@
return st;
}
-void celt_decoder_destroy(CELTDecoder *st)
+void EXPORT celt_decoder_destroy(CELTDecoder *st)
{
if (st == NULL)
{
@@ -544,7 +544,7 @@
RESTORE_STACK;
}
-int celt_decode(CELTDecoder *st, unsigned char *data, int len, celt_int16_t *pcm)
+int EXPORT celt_decode(CELTDecoder *st, unsigned char *data, int len, celt_int16_t *pcm)
{
int i, c, N, B, C, N4;
int has_pitch;
--- a/libcelt/header.c
+++ b/libcelt/header.c
@@ -62,7 +62,7 @@
return ret;
}
-void celt_header_init(CELTHeader *header, const CELTMode *m)
+void EXPORT celt_header_init(CELTHeader *header, const CELTMode *m)
{
CELT_COPY(header->codec_id, "CELT ", 8);
CELT_COPY(header->codec_version, "experimental ", 20);
@@ -77,7 +77,7 @@
header->extra_headers = 0;
}
-int celt_header_to_packet(const CELTHeader *header, unsigned char *packet, celt_uint32_t size)
+int EXPORT celt_header_to_packet(const CELTHeader *header, unsigned char *packet, celt_uint32_t size)
{
celt_int32_t * h;
@@ -103,7 +103,7 @@
return sizeof(*header);
}
-int celt_header_from_packet(const unsigned char *packet, celt_uint32_t size, CELTHeader *header)
+int EXPORT celt_header_from_packet(const unsigned char *packet, celt_uint32_t size, CELTHeader *header)
{
CELT_COPY((unsigned char*)header, packet, sizeof(*header));
return sizeof(*header);
--- a/libcelt/modes.c
+++ b/libcelt/modes.c
@@ -50,7 +50,7 @@
#endif
-int celt_mode_info(const CELTMode *mode, int request, celt_int32_t *value)
+int EXPORT celt_mode_info(const CELTMode *mode, int request, celt_int32_t *value)
{
switch (request)
{
@@ -219,7 +219,7 @@
#endif /* STATIC_MODES */
-CELTMode *celt_mode_create(celt_int32_t Fs, int channels, int frame_size, int lookahead, int *error)
+CELTMode EXPORT *celt_mode_create(celt_int32_t Fs, int channels, int frame_size, int lookahead, int *error)
{
#ifdef STATIC_MODES
const CELTMode *m = NULL;
@@ -320,7 +320,7 @@
return mode;
}
-void celt_mode_destroy(CELTMode *mode)
+void EXPORT celt_mode_destroy(CELTMode *mode)
{
mdct_clear(&mode->mdct);
#ifndef STATIC_MODES
--- a/libcelt/os_support.h
+++ b/libcelt/os_support.h
@@ -42,6 +42,14 @@
#include <stdio.h>
#include <stdlib.h>
+#ifdef __GNUC__
+#define EXPORT __attribute__ ((visibility ("default")))
+#elif defined(WIN32)
+#define EXPORT __declspec(dllexport)
+#else
+#define EXPORT
+#endif
+
/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, celt_realloc and celt_free
NOTE: celt_alloc needs to CLEAR THE MEMORY */
#ifndef OVERRIDE_CELT_ALLOC