mirror of
https://gitlab.freedesktop.org/uchardet/uchardet.git
synced 2025-12-06 16:56:40 +08:00
Add dllexport to interface functions
This allows building the DLL on Windows with other compilers than GNU ones. See MR !4.
This commit is contained in:
parent
2694ba6363
commit
ae7acbd0f2
@ -79,6 +79,10 @@ add_library(
|
||||
${UCHARDET_LIBRARY}
|
||||
${UCHARDET_SOURCES}
|
||||
)
|
||||
target_compile_definitions("${UCHARDET_LIBRARY}" PRIVATE BUILDING_UCHARDET)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
target_compile_definitions("${UCHARDET_LIBRARY}" PUBLIC UCHARDET_SHARED)
|
||||
endif()
|
||||
|
||||
if (UCHARDET_STATIC_LIBRARY)
|
||||
add_library(
|
||||
@ -86,6 +90,7 @@ if (UCHARDET_STATIC_LIBRARY)
|
||||
STATIC
|
||||
${UCHARDET_SOURCES}
|
||||
)
|
||||
target_compile_definitions("${UCHARDET_STATIC_LIBRARY}" PRIVATE BUILDING_UCHARDET)
|
||||
endif (UCHARDET_STATIC_LIBRARY)
|
||||
|
||||
set_target_properties(
|
||||
|
||||
@ -44,6 +44,17 @@ extern "C" {
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#if defined(UCHARDET_SHARED) && (defined(_WIN32) || defined(__CYGWIN__))
|
||||
#ifdef BUILDING_UCHARDET
|
||||
#define UCHARDET_INTERFACE __declspec(dllexport)
|
||||
#else
|
||||
#define UCHARDET_INTERFACE __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#define UCHARDET_INTERFACE
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* A handle for a uchardet encoding detector.
|
||||
*/
|
||||
@ -53,13 +64,13 @@ typedef struct uchardet * uchardet_t;
|
||||
* Create an encoding detector.
|
||||
* @return an instance of uchardet_t.
|
||||
*/
|
||||
uchardet_t uchardet_new(void);
|
||||
UCHARDET_INTERFACE uchardet_t uchardet_new(void);
|
||||
|
||||
/**
|
||||
* Delete an encoding detector.
|
||||
* @param ud [in] the uchardet_t handle to delete.
|
||||
*/
|
||||
void uchardet_delete(uchardet_t ud);
|
||||
UCHARDET_INTERFACE void uchardet_delete(uchardet_t ud);
|
||||
|
||||
/**
|
||||
* Feed data to an encoding detector.
|
||||
@ -72,26 +83,26 @@ void uchardet_delete(uchardet_t ud);
|
||||
* @param len [in] number of byte of data
|
||||
* @return non-zero number on failure.
|
||||
*/
|
||||
int uchardet_handle_data(uchardet_t ud, const char * data, size_t len);
|
||||
UCHARDET_INTERFACE int uchardet_handle_data(uchardet_t ud, const char * data, size_t len);
|
||||
|
||||
/**
|
||||
* Notify an end of data to an encoding detector.
|
||||
* @param ud [in] handle of an instance of uchardet
|
||||
*/
|
||||
void uchardet_data_end(uchardet_t ud);
|
||||
UCHARDET_INTERFACE void uchardet_data_end(uchardet_t ud);
|
||||
|
||||
/**
|
||||
* Reset an encoding detector.
|
||||
* @param ud [in] handle of an instance of uchardet
|
||||
*/
|
||||
void uchardet_reset(uchardet_t ud);
|
||||
UCHARDET_INTERFACE void uchardet_reset(uchardet_t ud);
|
||||
|
||||
/**
|
||||
* Get an iconv-compatible name of the encoding that was detected.
|
||||
* @param ud [in] handle of an instance of uchardet
|
||||
* @return name of charset on success and "" on failure.
|
||||
*/
|
||||
const char * uchardet_get_charset(uchardet_t ud);
|
||||
UCHARDET_INTERFACE const char * uchardet_get_charset(uchardet_t ud);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user