update api visibility macros for windows

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12547 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2009-03-10 15:45:29 +00:00
parent 674a18f930
commit b1377e015b
7 changed files with 55 additions and 35 deletions

View File

@ -45,7 +45,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="src" AdditionalIncludeDirectories="src"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@ -122,7 +122,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="src" AdditionalIncludeDirectories="src"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@ -199,7 +199,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="src" AdditionalIncludeDirectories="src"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"
RuntimeLibrary="2" RuntimeLibrary="2"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="4" WarningLevel="4"
@ -272,7 +272,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="src" AdditionalIncludeDirectories="src"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"
RuntimeLibrary="2" RuntimeLibrary="2"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="4" WarningLevel="4"

View File

@ -41,7 +41,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="src" AdditionalIncludeDirectories="src"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@ -119,7 +119,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="src" AdditionalIncludeDirectories="src"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"
RuntimeLibrary="2" RuntimeLibrary="2"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="4" WarningLevel="4"

View File

@ -110,10 +110,30 @@ typedef __int16 int16_t;
#define teletone_assert(expr) assert(expr) #define teletone_assert(expr) assert(expr)
#endif #endif
#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(HAVE_VISIBILITY) #ifdef _MSC_VER
#define TELETONE_API __attribute__((visibility("default"))) #if defined(TT_DECLARE_STATIC)
#define TELETONE_API(type) type __stdcall
#define TELETONE_API_NONSTD(type) type __cdecl
#define TELETONE_API_DATA
#elif defined(TELETONE_EXPORTS)
#define TELETONE_API(type) __declspec(dllexport) type __stdcall
#define TELETONE_API_NONSTD(type) __declspec(dllexport) type __cdecl
#define TELETONE_API_DATA __declspec(dllexport)
#else #else
#define TELETONE_API #define TELETONE_API(type) __declspec(dllimport) type __stdcall
#define TELETONE_API_NONSTD(type) __declspec(dllimport) type __cdecl
#define TELETONE_API_DATA __declspec(dllimport)
#endif
#else
#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(HAVE_VISIBILITY)
#define TELETONE_API(type) __attribute__((visibility("default"))) type
#define TELETONE_API_NONSTD(type) __attribute__((visibility("default"))) type
#define TELETONE_API_DATA __attribute__((visibility("default")))
#else
#define TELETONE_API(type) type
#define TELETONE_API_NONSTD(type) type
#define TELETONE_API_DATA
#endif
#endif #endif
#include <libteletone_generate.h> #include <libteletone_generate.h>

View File

@ -116,7 +116,7 @@ static void goertzel_init(teletone_goertzel_state_t *goertzel_state, teletone_de
goertzel_state->fac = tdesc->fac; goertzel_state->fac = tdesc->fac;
} }
TELETONE_API void teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state, TELETONE_API(void) teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state,
int16_t sample_buffer[], int16_t sample_buffer[],
int samples) int samples)
{ {
@ -135,7 +135,7 @@ TELETONE_API void teletone_goertzel_update(teletone_goertzel_state_t *goertzel_s
#define teletone_goertzel_result(gs) (double)(((gs)->v3 * (gs)->v3 + (gs)->v2 * (gs)->v2 - (gs)->v2 * (gs)->v3 * (gs)->fac)) #define teletone_goertzel_result(gs) (double)(((gs)->v3 * (gs)->v3 + (gs)->v2 * (gs)->v2 - (gs)->v2 * (gs)->v3 * (gs)->fac))
TELETONE_API void teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate) TELETONE_API(void) teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate)
{ {
int i; int i;
float theta; float theta;
@ -169,7 +169,7 @@ TELETONE_API void teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_
dtmf_detect_state->mhit = 0; dtmf_detect_state->mhit = 0;
} }
TELETONE_API void teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map) TELETONE_API(void) teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map)
{ {
float theta = 0; float theta = 0;
int x = 0; int x = 0;
@ -209,7 +209,7 @@ TELETONE_API void teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_t
} }
TELETONE_API int teletone_multi_tone_detect (teletone_multi_tone_t *mt, TELETONE_API(int) teletone_multi_tone_detect (teletone_multi_tone_t *mt,
int16_t sample_buffer[], int16_t sample_buffer[],
int samples) int samples)
{ {
@ -299,7 +299,7 @@ TELETONE_API int teletone_multi_tone_detect (teletone_multi_tone_t *mt,
} }
TELETONE_API int teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state, TELETONE_API(int) teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state,
int16_t sample_buffer[], int16_t sample_buffer[],
int samples) int samples)
{ {
@ -430,7 +430,7 @@ TELETONE_API int teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect
} }
TELETONE_API int teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state, TELETONE_API(int) teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state,
char *buf, char *buf,
int max) int max)
{ {

View File

@ -202,7 +202,7 @@ extern "C" {
\param mt the multi-frequency tone descriptor \param mt the multi-frequency tone descriptor
\param map a representation of the multi-frequency tone \param map a representation of the multi-frequency tone
*/ */
TELETONE_API void teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map); TELETONE_API(void) teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map);
/*! /*!
\brief Check a sample buffer for the presence of the mulit-frequency tone described by mt \brief Check a sample buffer for the presence of the mulit-frequency tone described by mt
@ -211,7 +211,7 @@ TELETONE_API void teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_t
\param samples the number of samples present in sample_buffer \param samples the number of samples present in sample_buffer
\return true when the tone was detected or false when it is not \return true when the tone was detected or false when it is not
*/ */
TELETONE_API int teletone_multi_tone_detect (teletone_multi_tone_t *mt, TELETONE_API(int) teletone_multi_tone_detect (teletone_multi_tone_t *mt,
int16_t sample_buffer[], int16_t sample_buffer[],
int samples); int samples);
@ -220,7 +220,7 @@ TELETONE_API int teletone_multi_tone_detect (teletone_multi_tone_t *mt,
\param dtmf_detect_state the DTMF detection state to initilize \param dtmf_detect_state the DTMF detection state to initilize
\param sample_rate the desired sample rate \param sample_rate the desired sample rate
*/ */
TELETONE_API void teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate); TELETONE_API(void) teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate);
/*! /*!
\brief Check a sample buffer for the presence of DTMF digits \brief Check a sample buffer for the presence of DTMF digits
@ -229,7 +229,7 @@ TELETONE_API void teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_
\param samples the number of samples present in sample_buffer \param samples the number of samples present in sample_buffer
\return true when DTMF was detected or false when it is not \return true when DTMF was detected or false when it is not
*/ */
TELETONE_API int teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state, TELETONE_API(int) teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state,
int16_t sample_buffer[], int16_t sample_buffer[],
int samples); int samples);
/*! /*!
@ -239,7 +239,7 @@ TELETONE_API int teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect
\param max the maximum length of buf \param max the maximum length of buf
\return the number of characters written to buf \return the number of characters written to buf
*/ */
TELETONE_API int teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state, TELETONE_API(int) teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state,
char *buf, char *buf,
int max); int max);
@ -249,7 +249,7 @@ TELETONE_API int teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_st
\param sample_buffer an array aof 16 bit signed linear samples \param sample_buffer an array aof 16 bit signed linear samples
\param samples the number of samples present in sample_buffer \param samples the number of samples present in sample_buffer
*/ */
TELETONE_API void teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state, TELETONE_API(void) teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state,
int16_t sample_buffer[], int16_t sample_buffer[],
int samples); int samples);

View File

@ -79,7 +79,7 @@
#pragma warning(disable:4706) #pragma warning(disable:4706)
#endif #endif
TELETONE_API int16_t TELETONE_SINES[SINE_TABLE_MAX] = { TELETONE_API_DATA int16_t TELETONE_SINES[SINE_TABLE_MAX] = {
0x00c9, 0x025b, 0x03ed, 0x057f, 0x0711, 0x08a2, 0x0a33, 0x0bc4, 0x00c9, 0x025b, 0x03ed, 0x057f, 0x0711, 0x08a2, 0x0a33, 0x0bc4,
0x0d54, 0x0ee4, 0x1073, 0x1201, 0x138f, 0x151c, 0x16a8, 0x1833, 0x0d54, 0x0ee4, 0x1073, 0x1201, 0x138f, 0x151c, 0x16a8, 0x1833,
0x19be, 0x1b47, 0x1cd0, 0x1e57, 0x1fdd, 0x2162, 0x22e5, 0x2467, 0x19be, 0x1b47, 0x1cd0, 0x1e57, 0x1fdd, 0x2162, 0x22e5, 0x2467,
@ -99,7 +99,7 @@ TELETONE_API int16_t TELETONE_SINES[SINE_TABLE_MAX] = {
}; };
TELETONE_API int teletone_set_tone(teletone_generation_session_t *ts, int index, ...) TELETONE_API(int) teletone_set_tone(teletone_generation_session_t *ts, int index, ...)
{ {
va_list ap; va_list ap;
int i = 0; int i = 0;
@ -115,7 +115,7 @@ TELETONE_API int teletone_set_tone(teletone_generation_session_t *ts, int index,
} }
TELETONE_API int teletone_set_map(teletone_tone_map_t *map, ...) TELETONE_API(int) teletone_set_map(teletone_tone_map_t *map, ...)
{ {
va_list ap; va_list ap;
int i = 0; int i = 0;
@ -131,7 +131,7 @@ TELETONE_API int teletone_set_map(teletone_tone_map_t *map, ...)
} }
TELETONE_API int teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_handler handler, void *user_data) TELETONE_API(int) teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_handler handler, void *user_data)
{ {
memset(ts, 0, sizeof(*ts)); memset(ts, 0, sizeof(*ts));
ts->rate = 8000; ts->rate = 8000;
@ -174,7 +174,7 @@ TELETONE_API int teletone_init_session(teletone_generation_session_t *ts, int bu
return 0; return 0;
} }
TELETONE_API int teletone_destroy_session(teletone_generation_session_t *ts) TELETONE_API(int) teletone_destroy_session(teletone_generation_session_t *ts)
{ {
if (ts->buffer) { if (ts->buffer) {
free(ts->buffer); free(ts->buffer);
@ -203,7 +203,7 @@ static int ensure_buffer(teletone_generation_session_t *ts, int need)
return 0; return 0;
} }
TELETONE_API int teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *map) TELETONE_API(int) teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *map)
{ {
/*teletone_process_t period = (1.0 / ts->rate) / ts->channels;*/ /*teletone_process_t period = (1.0 / ts->rate) / ts->channels;*/
int i, c; int i, c;
@ -318,7 +318,7 @@ static char *my_strdup (const char *s)
return (char *) memcpy (new, s, len); return (char *) memcpy (new, s, len);
} }
TELETONE_API int teletone_run(teletone_generation_session_t *ts, const char *cmd) TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cmd)
{ {
char *data = NULL, *cur = NULL, *end = NULL; char *data = NULL, *cur = NULL, *end = NULL;
int var = 0, LOOPING = 0; int var = 0, LOOPING = 0;

View File

@ -137,7 +137,7 @@ typedef struct teletone_dds_state teletone_dds_state_t;
/* 3.02 represents twice the power */ /* 3.02 represents twice the power */
#define DBM0_MAX_POWER (3.14f + 3.02f) #define DBM0_MAX_POWER (3.14f + 3.02f)
TELETONE_API extern int16_t TELETONE_SINES[SINE_TABLE_MAX]; TELETONE_API_DATA extern int16_t TELETONE_SINES[SINE_TABLE_MAX];
static __inline__ int32_t teletone_dds_phase_rate(teletone_process_t tone, uint32_t rate) static __inline__ int32_t teletone_dds_phase_rate(teletone_process_t tone, uint32_t rate)
{ {
@ -255,7 +255,7 @@ typedef struct teletone_generation_session teletone_generation_session_t;
\param ... up to TELETONE_MAX_TONES frequencies terminated by 0.0 \param ... up to TELETONE_MAX_TONES frequencies terminated by 0.0
\return 0 \return 0
*/ */
TELETONE_API int teletone_set_tone(teletone_generation_session_t *ts, int index, ...); TELETONE_API(int) teletone_set_tone(teletone_generation_session_t *ts, int index, ...);
/*! /*!
\brief Assign a set of tones to a single tone map \brief Assign a set of tones to a single tone map
@ -263,7 +263,7 @@ TELETONE_API int teletone_set_tone(teletone_generation_session_t *ts, int index,
\param ... up to TELETONE_MAX_TONES frequencies terminated by 0.0 \param ... up to TELETONE_MAX_TONES frequencies terminated by 0.0
\return 0 \return 0
*/ */
TELETONE_API int teletone_set_map(teletone_tone_map_t *map, ...); TELETONE_API(int) teletone_set_map(teletone_tone_map_t *map, ...);
/*! /*!
\brief Initilize a tone generation session \brief Initilize a tone generation session
@ -273,14 +273,14 @@ TELETONE_API int teletone_set_map(teletone_tone_map_t *map, ...);
\param user_data optional user data to send \param user_data optional user data to send
\return 0 \return 0
*/ */
TELETONE_API int teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_handler handler, void *user_data); TELETONE_API(int) teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_handler handler, void *user_data);
/*! /*!
\brief Free the buffer allocated by a tone generation session \brief Free the buffer allocated by a tone generation session
\param ts the tone generation session to destroy \param ts the tone generation session to destroy
\return 0 \return 0
*/ */
TELETONE_API int teletone_destroy_session(teletone_generation_session_t *ts); TELETONE_API(int) teletone_destroy_session(teletone_generation_session_t *ts);
/*! /*!
\brief Execute a single tone generation instruction \brief Execute a single tone generation instruction
@ -288,7 +288,7 @@ TELETONE_API int teletone_destroy_session(teletone_generation_session_t *ts);
\param map the tone mapping to use for the frequencies \param map the tone mapping to use for the frequencies
\return 0 \return 0
*/ */
TELETONE_API int teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *map); TELETONE_API(int) teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *map);
/*! /*!
\brief Execute a tone generation script and call callbacks after each instruction \brief Execute a tone generation script and call callbacks after each instruction
@ -296,7 +296,7 @@ TELETONE_API int teletone_mux_tones(teletone_generation_session_t *ts, teletone_
\param cmd the script to execute \param cmd the script to execute
\return 0 \return 0
*/ */
TELETONE_API int teletone_run(teletone_generation_session_t *ts, const char *cmd); TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cmd);
#ifdef __cplusplus #ifdef __cplusplus
} }