mirror of https://github.com/eclipse/paho.mqtt.c
Merge branch 'fixup-win32-global-init' of https://github.com/raffienficiaud/paho.mqtt.c into raffienficiaud-fixup-win32-global-init
This commit is contained in:
commit
227fba3138
2
Makefile
2
Makefile
|
|
@ -156,7 +156,7 @@ PAHO_CS_SUB_TARGET = ${blddir}/samples/${PAHO_CS_SUB_NAME}
|
|||
#FLAGS_EXE = $(LDFLAGS) -I ${srcdir} -lpthread -L ${blddir}
|
||||
#FLAGS_EXES = $(LDFLAGS) -I ${srcdir} ${START_GROUP} -lpthread -lssl -lcrypto ${END_GROUP} -L ${blddir}
|
||||
|
||||
CCFLAGS_SO = -g -fPIC $(CFLAGS) -D_GNU_SOURCE -Os -Wall -fvisibility=hidden -I$(blddir_work)
|
||||
CCFLAGS_SO = -g -fPIC $(CFLAGS) -D_GNU_SOURCE -Os -Wall -fvisibility=hidden -I$(blddir_work) -DMQTT_EXPORTS=1
|
||||
FLAGS_EXE = $(LDFLAGS) -I ${srcdir} ${START_GROUP} -lpthread ${GAI_LIB} ${END_GROUP} -L ${blddir}
|
||||
FLAGS_EXES = $(LDFLAGS) -I ${srcdir} ${START_GROUP} -lpthread ${GAI_LIB} -lssl -lcrypto ${END_GROUP} -L ${blddir}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#*******************************************************************************
|
||||
# Copyright (c) 2015, 2018 logi.cals GmbH and others
|
||||
# Copyright (c) 2015, 2019 logi.cals GmbH and others
|
||||
#
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
|
|
@ -67,7 +67,9 @@ ENDIF()
|
|||
|
||||
## common compilation for libpaho-mqtt3c and libpaho-mqtt3a
|
||||
ADD_LIBRARY(common_obj OBJECT ${common_src})
|
||||
SET_PROPERTY(TARGET common_obj PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
SET_TARGET_PROPERTIES(common_obj PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
COMPILE_DEFINITIONS "MQTT_EXPORTS=1")
|
||||
|
||||
ADD_EXECUTABLE(MQTTVersion MQTTVersion.c)
|
||||
|
||||
|
|
@ -81,7 +83,8 @@ TARGET_LINK_LIBRARIES(MQTTVersion paho-mqtt3a paho-mqtt3c ${LIBS_SYSTEM})
|
|||
SET_TARGET_PROPERTIES(
|
||||
paho-mqtt3c paho-mqtt3a PROPERTIES
|
||||
VERSION ${CLIENT_VERSION}
|
||||
SOVERSION ${PAHO_VERSION_MAJOR})
|
||||
SOVERSION ${PAHO_VERSION_MAJOR}
|
||||
DEFINE_SYMBOL "MQTT_EXPORTS")
|
||||
FOREACH(TARGET paho-mqtt3c paho-mqtt3a)
|
||||
TARGET_INCLUDE_DIRECTORIES(${TARGET}
|
||||
PUBLIC
|
||||
|
|
@ -91,7 +94,6 @@ FOREACH(TARGET paho-mqtt3c paho-mqtt3a)
|
|||
${CMAKE_BINARY_DIR})
|
||||
ENDFOREACH()
|
||||
|
||||
|
||||
INSTALL(TARGETS paho-mqtt3c paho-mqtt3a
|
||||
EXPORT eclipse-paho-mqtt-cTargets
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
|
|
|
|||
|
|
@ -73,8 +73,12 @@
|
|||
const char *client_timestamp_eye = "MQTTAsyncV3_Timestamp " BUILD_TIMESTAMP;
|
||||
const char *client_version_eye = "MQTTAsyncV3_Version " CLIENT_VERSION;
|
||||
|
||||
// global objects init declaration
|
||||
void MQTTAsync_init();
|
||||
|
||||
void MQTTAsync_global_init(MQTTAsync_init_options* inits)
|
||||
{
|
||||
MQTTAsync_init();
|
||||
#if defined(OPENSSL)
|
||||
SSLSocket_handleOpensslInit(inits->do_openssl_init);
|
||||
#endif
|
||||
|
|
@ -120,30 +124,45 @@ BOOL APIENTRY DllMain(HANDLE hModule,
|
|||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
Log(TRACE_MAX, -1, "DLL process attach");
|
||||
if (mqttasync_mutex == NULL)
|
||||
{
|
||||
mqttasync_mutex = CreateMutex(NULL, 0, NULL);
|
||||
mqttcommand_mutex = CreateMutex(NULL, 0, NULL);
|
||||
send_sem = CreateEvent(
|
||||
NULL, /* default security attributes */
|
||||
FALSE, /* manual-reset event? */
|
||||
FALSE, /* initial state is nonsignaled */
|
||||
NULL /* object name */
|
||||
);
|
||||
stack_mutex = CreateMutex(NULL, 0, NULL);
|
||||
heap_mutex = CreateMutex(NULL, 0, NULL);
|
||||
log_mutex = CreateMutex(NULL, 0, NULL);
|
||||
socket_mutex = CreateMutex(NULL, 0, NULL);
|
||||
}
|
||||
MQTTAsync_init();
|
||||
break;
|
||||
case DLL_THREAD_ATTACH:
|
||||
Log(TRACE_MAX, -1, "DLL thread attach");
|
||||
break;
|
||||
case DLL_THREAD_DETACH:
|
||||
Log(TRACE_MAX, -1, "DLL thread detach");
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
Log(TRACE_MAX, -1, "DLL process detach");
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void MQTTAsync_init(void)
|
||||
{
|
||||
if (mqttasync_mutex == NULL)
|
||||
{
|
||||
mqttasync_mutex = CreateMutex(NULL, 0, NULL);
|
||||
mqttcommand_mutex = CreateMutex(NULL, 0, NULL);
|
||||
send_sem = CreateEvent(
|
||||
NULL, /* default security attributes */
|
||||
FALSE, /* manual-reset event? */
|
||||
FALSE, /* initial state is nonsignaled */
|
||||
NULL /* object name */
|
||||
);
|
||||
stack_mutex = CreateMutex(NULL, 0, NULL);
|
||||
heap_mutex = CreateMutex(NULL, 0, NULL);
|
||||
log_mutex = CreateMutex(NULL, 0, NULL);
|
||||
socket_mutex = CreateMutex(NULL, 0, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(TRACE_MAX, -1, "Library already initialized");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
static pthread_mutex_t mqttasync_mutex_store = PTHREAD_MUTEX_INITIALIZER;
|
||||
static mutex_type mqttasync_mutex = &mqttasync_mutex_store;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009, 2018 IBM Corp.
|
||||
* Copyright (c) 2009, 2019 IBM Corp.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
|
|
@ -93,11 +93,17 @@
|
|||
#endif
|
||||
|
||||
#if defined(WIN32) || defined(WIN64)
|
||||
#define DLLImport __declspec(dllimport)
|
||||
#define DLLExport __declspec(dllexport)
|
||||
#if defined(MQTT_EXPORTS)
|
||||
#define LIBMQTT_API __declspec(dllexport)
|
||||
#else
|
||||
#define LIBMQTT_API __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#define DLLImport extern
|
||||
#define DLLExport __attribute__ ((visibility ("default")))
|
||||
#if defined(MQTT_EXPORTS)
|
||||
#define LIBMQTT_API __attribute__ ((visibility ("default")))
|
||||
#else
|
||||
#define LIBMQTT_API extern
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
@ -232,7 +238,7 @@ typedef struct
|
|||
* Global init of mqtt library. Call once on program start to set global behaviour.
|
||||
* handle_openssl_init - if mqtt library should handle openssl init (1) or rely on the caller to init it before using mqtt (0)
|
||||
*/
|
||||
DLLExport void MQTTAsync_global_init(MQTTAsync_init_options* inits);
|
||||
LIBMQTT_API void MQTTAsync_global_init(MQTTAsync_init_options* inits);
|
||||
|
||||
/**
|
||||
* A handle representing an MQTT client. A valid client handle is available
|
||||
|
|
@ -441,7 +447,7 @@ typedef void MQTTAsync_disconnected(void* context, MQTTProperties* properties,
|
|||
* @return ::MQTTASYNC_SUCCESS if the callbacks were correctly set,
|
||||
* ::MQTTASYNC_FAILURE if an error occurred.
|
||||
*/
|
||||
DLLExport int MQTTAsync_setDisconnected(MQTTAsync handle, void* context, MQTTAsync_disconnected* co);
|
||||
LIBMQTT_API int MQTTAsync_setDisconnected(MQTTAsync handle, void* context, MQTTAsync_disconnected* co);
|
||||
|
||||
|
||||
/** The data returned on completion of an unsuccessful API call in the response callback onFailure. */
|
||||
|
|
@ -706,7 +712,7 @@ typedef struct MQTTAsync_responseOptions MQTTAsync_callOptions;
|
|||
* @return ::MQTTASYNC_SUCCESS if the callbacks were correctly set,
|
||||
* ::MQTTASYNC_FAILURE if an error occurred.
|
||||
*/
|
||||
DLLExport int MQTTAsync_setCallbacks(MQTTAsync handle, void* context, MQTTAsync_connectionLost* cl,
|
||||
LIBMQTT_API int MQTTAsync_setCallbacks(MQTTAsync handle, void* context, MQTTAsync_connectionLost* cl,
|
||||
MQTTAsync_messageArrived* ma, MQTTAsync_deliveryComplete* dc);
|
||||
|
||||
/**
|
||||
|
|
@ -729,7 +735,7 @@ DLLExport int MQTTAsync_setCallbacks(MQTTAsync handle, void* context, MQTTAsync_
|
|||
* ::MQTTASYNC_FAILURE if an error occurred.
|
||||
*/
|
||||
|
||||
DLLExport int MQTTAsync_setConnectionLostCallback(MQTTAsync handle, void* context,
|
||||
LIBMQTT_API int MQTTAsync_setConnectionLostCallback(MQTTAsync handle, void* context,
|
||||
MQTTAsync_connectionLost* cl);
|
||||
|
||||
/**
|
||||
|
|
@ -753,7 +759,7 @@ DLLExport int MQTTAsync_setConnectionLostCallback(MQTTAsync handle, void* contex
|
|||
* @return ::MQTTASYNC_SUCCESS if the callbacks were correctly set,
|
||||
* ::MQTTASYNC_FAILURE if an error occurred.
|
||||
*/
|
||||
DLLExport int MQTTAsync_setMessageArrivedCallback(MQTTAsync handle, void* context,
|
||||
LIBMQTT_API int MQTTAsync_setMessageArrivedCallback(MQTTAsync handle, void* context,
|
||||
MQTTAsync_messageArrived* ma);
|
||||
|
||||
/**
|
||||
|
|
@ -775,7 +781,7 @@ DLLExport int MQTTAsync_setMessageArrivedCallback(MQTTAsync handle, void* contex
|
|||
* @return ::MQTTASYNC_SUCCESS if the callbacks were correctly set,
|
||||
* ::MQTTASYNC_FAILURE if an error occurred.
|
||||
*/
|
||||
DLLExport int MQTTAsync_setDeliveryCompleteCallback(MQTTAsync handle, void* context,
|
||||
LIBMQTT_API int MQTTAsync_setDeliveryCompleteCallback(MQTTAsync handle, void* context,
|
||||
MQTTAsync_deliveryComplete* dc);
|
||||
|
||||
/**
|
||||
|
|
@ -790,7 +796,7 @@ DLLExport int MQTTAsync_setDeliveryCompleteCallback(MQTTAsync handle, void* cont
|
|||
* @return ::MQTTASYNC_SUCCESS if the callbacks were correctly set,
|
||||
* ::MQTTASYNC_FAILURE if an error occurred.
|
||||
*/
|
||||
DLLExport int MQTTAsync_setConnected(MQTTAsync handle, void* context, MQTTAsync_connected* co);
|
||||
LIBMQTT_API int MQTTAsync_setConnected(MQTTAsync handle, void* context, MQTTAsync_connected* co);
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -801,7 +807,7 @@ DLLExport int MQTTAsync_setConnected(MQTTAsync handle, void* context, MQTTAsync_
|
|||
* @return ::MQTTASYNC_SUCCESS if the callbacks were correctly set,
|
||||
* ::MQTTASYNC_FAILURE if an error occurred.
|
||||
*/
|
||||
DLLExport int MQTTAsync_reconnect(MQTTAsync handle);
|
||||
LIBMQTT_API int MQTTAsync_reconnect(MQTTAsync handle);
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -845,7 +851,7 @@ DLLExport int MQTTAsync_reconnect(MQTTAsync handle);
|
|||
* @return ::MQTTASYNC_SUCCESS if the client is successfully created, otherwise
|
||||
* an error code is returned.
|
||||
*/
|
||||
DLLExport int MQTTAsync_create(MQTTAsync* handle, const char* serverURI, const char* clientId,
|
||||
LIBMQTT_API int MQTTAsync_create(MQTTAsync* handle, const char* serverURI, const char* clientId,
|
||||
int persistence_type, void* persistence_context);
|
||||
|
||||
typedef struct
|
||||
|
|
@ -873,7 +879,7 @@ typedef struct
|
|||
#define MQTTAsync_createOptions_initializer5 { {'M', 'Q', 'C', 'O'}, 1, 0, 100, MQTTVERSION_5 }
|
||||
|
||||
|
||||
DLLExport int MQTTAsync_createWithOptions(MQTTAsync* handle, const char* serverURI, const char* clientId,
|
||||
LIBMQTT_API int MQTTAsync_createWithOptions(MQTTAsync* handle, const char* serverURI, const char* clientId,
|
||||
int persistence_type, void* persistence_context, MQTTAsync_createOptions* options);
|
||||
|
||||
/**
|
||||
|
|
@ -1239,7 +1245,7 @@ NULL, NULL, NULL, NULL, 0, NULL, MQTTVERSION_5, 0, 1, 60, {0, NULL}, NULL, 1, NU
|
|||
* <b>5</b>: Connection refused: Not authorized<br>
|
||||
* <b>6-255</b>: Reserved for future use<br>
|
||||
*/
|
||||
DLLExport int MQTTAsync_connect(MQTTAsync handle, const MQTTAsync_connectOptions* options);
|
||||
LIBMQTT_API int MQTTAsync_connect(MQTTAsync handle, const MQTTAsync_connectOptions* options);
|
||||
|
||||
|
||||
typedef struct
|
||||
|
|
@ -1317,7 +1323,7 @@ typedef struct
|
|||
* the server. An error code is returned if the client was unable to disconnect
|
||||
* from the server
|
||||
*/
|
||||
DLLExport int MQTTAsync_disconnect(MQTTAsync handle, const MQTTAsync_disconnectOptions* options);
|
||||
LIBMQTT_API int MQTTAsync_disconnect(MQTTAsync handle, const MQTTAsync_disconnectOptions* options);
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -1327,7 +1333,7 @@ DLLExport int MQTTAsync_disconnect(MQTTAsync handle, const MQTTAsync_disconnectO
|
|||
* MQTTAsync_create().
|
||||
* @return Boolean true if the client is connected, otherwise false.
|
||||
*/
|
||||
DLLExport int MQTTAsync_isConnected(MQTTAsync handle);
|
||||
LIBMQTT_API int MQTTAsync_isConnected(MQTTAsync handle);
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -1344,7 +1350,7 @@ DLLExport int MQTTAsync_isConnected(MQTTAsync handle);
|
|||
* An error code is returned if there was a problem registering the
|
||||
* subscription.
|
||||
*/
|
||||
DLLExport int MQTTAsync_subscribe(MQTTAsync handle, const char* topic, int qos, MQTTAsync_responseOptions* response);
|
||||
LIBMQTT_API int MQTTAsync_subscribe(MQTTAsync handle, const char* topic, int qos, MQTTAsync_responseOptions* response);
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -1364,7 +1370,7 @@ DLLExport int MQTTAsync_subscribe(MQTTAsync handle, const char* topic, int qos,
|
|||
* An error code is returned if there was a problem registering the
|
||||
* subscriptions.
|
||||
*/
|
||||
DLLExport int MQTTAsync_subscribeMany(MQTTAsync handle, int count, char* const* topic, int* qos, MQTTAsync_responseOptions* response);
|
||||
LIBMQTT_API int MQTTAsync_subscribeMany(MQTTAsync handle, int count, char* const* topic, int* qos, MQTTAsync_responseOptions* response);
|
||||
|
||||
/**
|
||||
* This function attempts to remove an existing subscription made by the
|
||||
|
|
@ -1378,7 +1384,7 @@ DLLExport int MQTTAsync_subscribeMany(MQTTAsync handle, int count, char* const*
|
|||
* An error code is returned if there was a problem removing the
|
||||
* subscription.
|
||||
*/
|
||||
DLLExport int MQTTAsync_unsubscribe(MQTTAsync handle, const char* topic, MQTTAsync_responseOptions* response);
|
||||
LIBMQTT_API int MQTTAsync_unsubscribe(MQTTAsync handle, const char* topic, MQTTAsync_responseOptions* response);
|
||||
|
||||
/**
|
||||
* This function attempts to remove existing subscriptions to a list of topics
|
||||
|
|
@ -1392,7 +1398,7 @@ DLLExport int MQTTAsync_unsubscribe(MQTTAsync handle, const char* topic, MQTTAsy
|
|||
* @return ::MQTTASYNC_SUCCESS if the subscriptions are removed.
|
||||
* An error code is returned if there was a problem removing the subscriptions.
|
||||
*/
|
||||
DLLExport int MQTTAsync_unsubscribeMany(MQTTAsync handle, int count, char* const* topic, MQTTAsync_responseOptions* response);
|
||||
LIBMQTT_API int MQTTAsync_unsubscribeMany(MQTTAsync handle, int count, char* const* topic, MQTTAsync_responseOptions* response);
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -1413,10 +1419,9 @@ DLLExport int MQTTAsync_unsubscribeMany(MQTTAsync handle, int count, char* const
|
|||
* @return ::MQTTASYNC_SUCCESS if the message is accepted for publication.
|
||||
* An error code is returned if there was a problem accepting the message.
|
||||
*/
|
||||
DLLExport int MQTTAsync_send(MQTTAsync handle, const char* destinationName, int payloadlen, const void* payload, int qos,
|
||||
LIBMQTT_API int MQTTAsync_send(MQTTAsync handle, const char* destinationName, int payloadlen, const void* payload, int qos,
|
||||
int retained, MQTTAsync_responseOptions* response);
|
||||
|
||||
|
||||
/**
|
||||
* This function attempts to publish a message to a given topic (see also
|
||||
* MQTTAsync_publish()). An ::MQTTAsync_token is issued when
|
||||
|
|
@ -1432,7 +1437,7 @@ DLLExport int MQTTAsync_send(MQTTAsync handle, const char* destinationName, int
|
|||
* @return ::MQTTASYNC_SUCCESS if the message is accepted for publication.
|
||||
* An error code is returned if there was a problem accepting the message.
|
||||
*/
|
||||
DLLExport int MQTTAsync_sendMessage(MQTTAsync handle, const char* destinationName, const MQTTAsync_message* msg, MQTTAsync_responseOptions* response);
|
||||
LIBMQTT_API int MQTTAsync_sendMessage(MQTTAsync handle, const char* destinationName, const MQTTAsync_message* msg, MQTTAsync_responseOptions* response);
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -1453,7 +1458,7 @@ DLLExport int MQTTAsync_sendMessage(MQTTAsync handle, const char* destinationNam
|
|||
* An error code is returned if there was a problem obtaining the list of
|
||||
* pending tokens.
|
||||
*/
|
||||
DLLExport int MQTTAsync_getPendingTokens(MQTTAsync handle, MQTTAsync_token **tokens);
|
||||
LIBMQTT_API int MQTTAsync_getPendingTokens(MQTTAsync handle, MQTTAsync_token **tokens);
|
||||
|
||||
/**
|
||||
* Tests whether a request corresponding to a token is complete.
|
||||
|
|
@ -1464,7 +1469,7 @@ DLLExport int MQTTAsync_getPendingTokens(MQTTAsync handle, MQTTAsync_token **tok
|
|||
* @return 1 if the request has been completed, 0 if not.
|
||||
*/
|
||||
#define MQTTASYNC_TRUE 1
|
||||
DLLExport int MQTTAsync_isComplete(MQTTAsync handle, MQTTAsync_token token);
|
||||
LIBMQTT_API int MQTTAsync_isComplete(MQTTAsync handle, MQTTAsync_token token);
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -1477,7 +1482,7 @@ DLLExport int MQTTAsync_isComplete(MQTTAsync handle, MQTTAsync_token token);
|
|||
* @return ::MQTTASYNC_SUCCESS if the request has been completed in the time allocated,
|
||||
* ::MQTTASYNC_FAILURE if not.
|
||||
*/
|
||||
DLLExport int MQTTAsync_waitForCompletion(MQTTAsync handle, MQTTAsync_token token, unsigned long timeout);
|
||||
LIBMQTT_API int MQTTAsync_waitForCompletion(MQTTAsync handle, MQTTAsync_token token, unsigned long timeout);
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -1490,7 +1495,7 @@ DLLExport int MQTTAsync_waitForCompletion(MQTTAsync handle, MQTTAsync_token toke
|
|||
* @param msg The address of a pointer to the ::MQTTAsync_message structure
|
||||
* to be freed.
|
||||
*/
|
||||
DLLExport void MQTTAsync_freeMessage(MQTTAsync_message** msg);
|
||||
LIBMQTT_API void MQTTAsync_freeMessage(MQTTAsync_message** msg);
|
||||
|
||||
/**
|
||||
* This function frees memory allocated by the MQTT C client library, especially the
|
||||
|
|
@ -1500,7 +1505,7 @@ DLLExport void MQTTAsync_freeMessage(MQTTAsync_message** msg);
|
|||
* allocated memory.
|
||||
* @param ptr The pointer to the client library storage to be freed.
|
||||
*/
|
||||
DLLExport void MQTTAsync_free(void* ptr);
|
||||
LIBMQTT_API void MQTTAsync_free(void* ptr);
|
||||
|
||||
/**
|
||||
* This function frees the memory allocated to an MQTT client (see
|
||||
|
|
@ -1509,7 +1514,7 @@ DLLExport void MQTTAsync_free(void* ptr);
|
|||
* @param handle A pointer to the handle referring to the ::MQTTAsync
|
||||
* structure to be freed.
|
||||
*/
|
||||
DLLExport void MQTTAsync_destroy(MQTTAsync* handle);
|
||||
LIBMQTT_API void MQTTAsync_destroy(MQTTAsync* handle);
|
||||
|
||||
|
||||
|
||||
|
|
@ -1530,7 +1535,7 @@ enum MQTTASYNC_TRACE_LEVELS
|
|||
* returned in the trace callback.
|
||||
* @param level the trace level required
|
||||
*/
|
||||
DLLExport void MQTTAsync_setTraceLevel(enum MQTTASYNC_TRACE_LEVELS level);
|
||||
LIBMQTT_API void MQTTAsync_setTraceLevel(enum MQTTASYNC_TRACE_LEVELS level);
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -1549,7 +1554,7 @@ typedef void MQTTAsync_traceCallback(enum MQTTASYNC_TRACE_LEVELS level, char* me
|
|||
* MQTTASYNC_TRACE_MINIMUM.
|
||||
* @param callback a pointer to the function which will handle the trace information
|
||||
*/
|
||||
DLLExport void MQTTAsync_setTraceCallback(MQTTAsync_traceCallback* callback);
|
||||
LIBMQTT_API void MQTTAsync_setTraceCallback(MQTTAsync_traceCallback* callback);
|
||||
|
||||
/**
|
||||
* This function returns version information about the library.
|
||||
|
|
@ -1557,7 +1562,7 @@ DLLExport void MQTTAsync_setTraceCallback(MQTTAsync_traceCallback* callback);
|
|||
* MQTTASYNC_TRACE_MINIMUM
|
||||
* @return an array of strings describing the library. The last entry is a NULL pointer.
|
||||
*/
|
||||
DLLExport MQTTAsync_nameValue* MQTTAsync_getVersionInfo(void);
|
||||
LIBMQTT_API MQTTAsync_nameValue* MQTTAsync_getVersionInfo(void);
|
||||
|
||||
/**
|
||||
* Returns a pointer to a string representation of the error code, or NULL.
|
||||
|
|
@ -1565,7 +1570,7 @@ DLLExport MQTTAsync_nameValue* MQTTAsync_getVersionInfo(void);
|
|||
* @param code the MQTTASYNC_ return code.
|
||||
* @return a static string representation of the error code.
|
||||
*/
|
||||
DLLExport const char* MQTTAsync_strerror(int code);
|
||||
LIBMQTT_API const char* MQTTAsync_strerror(int code);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -80,8 +80,11 @@
|
|||
const char *client_timestamp_eye = "MQTTClientV3_Timestamp " BUILD_TIMESTAMP;
|
||||
const char *client_version_eye = "MQTTClientV3_Version " CLIENT_VERSION;
|
||||
|
||||
void MQTTClient_init(void);
|
||||
|
||||
void MQTTClient_global_init(MQTTClient_init_options* inits)
|
||||
{
|
||||
MQTTClient_init();
|
||||
#if defined(OPENSSL)
|
||||
SSLSocket_handleOpensslInit(inits->do_openssl_init);
|
||||
#endif
|
||||
|
|
@ -114,26 +117,36 @@ BOOL APIENTRY DllMain(HANDLE hModule,
|
|||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
Log(TRACE_MAX, -1, "DLL process attach");
|
||||
if (mqttclient_mutex == NULL)
|
||||
{
|
||||
mqttclient_mutex = CreateMutex(NULL, 0, NULL);
|
||||
subscribe_mutex = CreateMutex(NULL, 0, NULL);
|
||||
unsubscribe_mutex = CreateMutex(NULL, 0, NULL);
|
||||
connect_mutex = CreateMutex(NULL, 0, NULL);
|
||||
stack_mutex = CreateMutex(NULL, 0, NULL);
|
||||
heap_mutex = CreateMutex(NULL, 0, NULL);
|
||||
log_mutex = CreateMutex(NULL, 0, NULL);
|
||||
socket_mutex = CreateMutex(NULL, 0, NULL);
|
||||
}
|
||||
MQTTClient_init();
|
||||
break;
|
||||
case DLL_THREAD_ATTACH:
|
||||
Log(TRACE_MAX, -1, "DLL thread attach");
|
||||
break;
|
||||
case DLL_THREAD_DETACH:
|
||||
Log(TRACE_MAX, -1, "DLL thread detach");
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
Log(TRACE_MAX, -1, "DLL process detach");
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void MQTTClient_init(void)
|
||||
{
|
||||
if (mqttclient_mutex == NULL)
|
||||
{
|
||||
mqttclient_mutex = CreateMutex(NULL, 0, NULL);
|
||||
subscribe_mutex = CreateMutex(NULL, 0, NULL);
|
||||
unsubscribe_mutex = CreateMutex(NULL, 0, NULL);
|
||||
connect_mutex = CreateMutex(NULL, 0, NULL);
|
||||
stack_mutex = CreateMutex(NULL, 0, NULL);
|
||||
heap_mutex = CreateMutex(NULL, 0, NULL);
|
||||
log_mutex = CreateMutex(NULL, 0, NULL);
|
||||
socket_mutex = CreateMutex(NULL, 0, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
static pthread_mutex_t mqttclient_mutex_store = PTHREAD_MUTEX_INITIALIZER;
|
||||
static mutex_type mqttclient_mutex = &mqttclient_mutex_store;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009, 2018 IBM Corp.
|
||||
* Copyright (c) 2009, 2019 IBM Corp.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
|
|
@ -111,11 +111,18 @@
|
|||
#endif
|
||||
|
||||
#if defined(WIN32) || defined(WIN64)
|
||||
#define DLLImport __declspec(dllimport)
|
||||
#define DLLExport __declspec(dllexport)
|
||||
#if defined(MQTT_EXPORTS)
|
||||
#define LIBMQTT_API __declspec(dllexport)
|
||||
#else
|
||||
#define LIBMQTT_API __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define DLLImport extern
|
||||
#define DLLExport __attribute__ ((visibility ("default")))
|
||||
#if defined(MQTT_EXPORTS)
|
||||
#define LIBMQTT_API __attribute__ ((visibility ("default")))
|
||||
#else
|
||||
#define LIBMQTT_API extern
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
@ -239,7 +246,7 @@ typedef struct
|
|||
* Global init of mqtt library. Call once on program start to set global behaviour.
|
||||
* do_openssl_init - if mqtt library should initialize OpenSSL (1) or rely on the caller to do it before using the library (0)
|
||||
*/
|
||||
DLLExport void MQTTClient_global_init(MQTTClient_init_options* inits);
|
||||
LIBMQTT_API void MQTTClient_global_init(MQTTClient_init_options* inits);
|
||||
|
||||
/**
|
||||
* A handle representing an MQTT client. A valid client handle is available
|
||||
|
|
@ -422,7 +429,7 @@ typedef void MQTTClient_connectionLost(void* context, char* cause);
|
|||
* @return ::MQTTCLIENT_SUCCESS if the callbacks were correctly set,
|
||||
* ::MQTTCLIENT_FAILURE if an error occurred.
|
||||
*/
|
||||
DLLExport int MQTTClient_setCallbacks(MQTTClient handle, void* context, MQTTClient_connectionLost* cl,
|
||||
LIBMQTT_API int MQTTClient_setCallbacks(MQTTClient handle, void* context, MQTTClient_connectionLost* cl,
|
||||
MQTTClient_messageArrived* ma, MQTTClient_deliveryComplete* dc);
|
||||
|
||||
|
||||
|
|
@ -451,7 +458,7 @@ typedef void MQTTClient_disconnected(void* context, MQTTProperties* properties,
|
|||
* @return ::MQTTCLIENT_SUCCESS if the callbacks were correctly set,
|
||||
* ::MQTTCLIENT_FAILURE if an error occurred.
|
||||
*/
|
||||
DLLExport int MQTTClient_setDisconnected(MQTTClient handle, void* context, MQTTClient_disconnected* co);
|
||||
LIBMQTT_API int MQTTClient_setDisconnected(MQTTClient handle, void* context, MQTTClient_disconnected* co);
|
||||
|
||||
/**
|
||||
* This is a callback function, the MQTT V5 version of MQTTClient_deliveryComplete().
|
||||
|
|
@ -479,7 +486,7 @@ DLLExport int MQTTClient_setDisconnected(MQTTClient handle, void* context, MQTTC
|
|||
typedef void MQTTClient_published(void* context, int dt, int packet_type, MQTTProperties* properties,
|
||||
enum MQTTReasonCodes reasonCode);
|
||||
|
||||
DLLExport int MQTTClient_setPublished(MQTTClient handle, void* context, MQTTClient_published* co);
|
||||
LIBMQTT_API int MQTTClient_setPublished(MQTTClient handle, void* context, MQTTClient_published* co);
|
||||
|
||||
/**
|
||||
* This function creates an MQTT client ready for connection to the
|
||||
|
|
@ -523,7 +530,7 @@ DLLExport int MQTTClient_setPublished(MQTTClient handle, void* context, MQTTClie
|
|||
* @return ::MQTTCLIENT_SUCCESS if the client is successfully created, otherwise
|
||||
* an error code is returned.
|
||||
*/
|
||||
DLLExport int MQTTClient_create(MQTTClient* handle, const char* serverURI, const char* clientId,
|
||||
LIBMQTT_API int MQTTClient_create(MQTTClient* handle, const char* serverURI, const char* clientId,
|
||||
int persistence_type, void* persistence_context);
|
||||
|
||||
typedef struct
|
||||
|
|
@ -586,7 +593,7 @@ typedef struct
|
|||
* @return ::MQTTCLIENT_SUCCESS if the client is successfully created, otherwise
|
||||
* an error code is returned.
|
||||
*/
|
||||
DLLExport int MQTTClient_createWithOptions(MQTTClient* handle, const char* serverURI, const char* clientId,
|
||||
LIBMQTT_API int MQTTClient_createWithOptions(MQTTClient* handle, const char* serverURI, const char* clientId,
|
||||
int persistence_type, void* persistence_context, MQTTClient_createOptions* options);
|
||||
|
||||
/**
|
||||
|
|
@ -758,7 +765,7 @@ typedef struct
|
|||
* no trace information will be returned.
|
||||
* @return an array of strings describing the library. The last entry is a NULL pointer.
|
||||
*/
|
||||
DLLExport MQTTClient_nameValue* MQTTClient_getVersionInfo(void);
|
||||
LIBMQTT_API MQTTClient_nameValue* MQTTClient_getVersionInfo(void);
|
||||
|
||||
/**
|
||||
* MQTTClient_connectOptions defines several settings that control the way the
|
||||
|
|
@ -943,7 +950,7 @@ typedef struct
|
|||
* <b>5</b>: Connection refused: Not authorized<br>
|
||||
* <b>6-255</b>: Reserved for future use<br>
|
||||
*/
|
||||
DLLExport int MQTTClient_connect(MQTTClient handle, MQTTClient_connectOptions* options);
|
||||
LIBMQTT_API int MQTTClient_connect(MQTTClient handle, MQTTClient_connectOptions* options);
|
||||
|
||||
|
||||
typedef struct MQTTResponse
|
||||
|
|
@ -957,9 +964,9 @@ typedef struct MQTTResponse
|
|||
|
||||
#define MQTTResponse_initializer {1, MQTTREASONCODE_SUCCESS, 0, NULL, NULL}
|
||||
|
||||
DLLExport void MQTTResponse_free(MQTTResponse response);
|
||||
LIBMQTT_API void MQTTResponse_free(MQTTResponse response);
|
||||
|
||||
DLLExport MQTTResponse MQTTClient_connect5(MQTTClient handle, MQTTClient_connectOptions* options,
|
||||
LIBMQTT_API MQTTResponse MQTTClient_connect5(MQTTClient handle, MQTTClient_connectOptions* options,
|
||||
MQTTProperties* connectProperties, MQTTProperties* willProperties);
|
||||
|
||||
/**
|
||||
|
|
@ -980,9 +987,9 @@ DLLExport MQTTResponse MQTTClient_connect5(MQTTClient handle, MQTTClient_connect
|
|||
* the server. An error code is returned if the client was unable to disconnect
|
||||
* from the server
|
||||
*/
|
||||
DLLExport int MQTTClient_disconnect(MQTTClient handle, int timeout);
|
||||
LIBMQTT_API int MQTTClient_disconnect(MQTTClient handle, int timeout);
|
||||
|
||||
DLLExport int MQTTClient_disconnect5(MQTTClient handle, int timeout, enum MQTTReasonCodes reason, MQTTProperties* props);
|
||||
LIBMQTT_API int MQTTClient_disconnect5(MQTTClient handle, int timeout, enum MQTTReasonCodes reason, MQTTProperties* props);
|
||||
|
||||
/**
|
||||
* This function allows the client application to test whether or not a
|
||||
|
|
@ -991,7 +998,7 @@ DLLExport int MQTTClient_disconnect5(MQTTClient handle, int timeout, enum MQTTRe
|
|||
* MQTTClient_create().
|
||||
* @return Boolean true if the client is connected, otherwise false.
|
||||
*/
|
||||
DLLExport int MQTTClient_isConnected(MQTTClient handle);
|
||||
LIBMQTT_API int MQTTClient_isConnected(MQTTClient handle);
|
||||
|
||||
|
||||
/* Subscribe is synchronous. QoS list parameter is changed on return to granted QoSs.
|
||||
|
|
@ -1010,10 +1017,10 @@ DLLExport int MQTTClient_isConnected(MQTTClient handle);
|
|||
* An error code is returned if there was a problem registering the
|
||||
* subscription.
|
||||
*/
|
||||
DLLExport int MQTTClient_subscribe(MQTTClient handle, const char* topic, int qos);
|
||||
LIBMQTT_API int MQTTClient_subscribe(MQTTClient handle, const char* topic, int qos);
|
||||
|
||||
|
||||
DLLExport MQTTResponse MQTTClient_subscribe5(MQTTClient handle, const char* topic, int qos,
|
||||
LIBMQTT_API MQTTResponse MQTTClient_subscribe5(MQTTClient handle, const char* topic, int qos,
|
||||
MQTTSubscribe_options* opts, MQTTProperties* props);
|
||||
|
||||
/**
|
||||
|
|
@ -1032,9 +1039,9 @@ DLLExport MQTTResponse MQTTClient_subscribe5(MQTTClient handle, const char* topi
|
|||
* An error code is returned if there was a problem registering the
|
||||
* subscriptions.
|
||||
*/
|
||||
DLLExport int MQTTClient_subscribeMany(MQTTClient handle, int count, char* const* topic, int* qos);
|
||||
LIBMQTT_API int MQTTClient_subscribeMany(MQTTClient handle, int count, char* const* topic, int* qos);
|
||||
|
||||
DLLExport MQTTResponse MQTTClient_subscribeMany5(MQTTClient handle, int count, char* const* topic,
|
||||
LIBMQTT_API MQTTResponse MQTTClient_subscribeMany5(MQTTClient handle, int count, char* const* topic,
|
||||
int* qos, MQTTSubscribe_options* opts, MQTTProperties* props);
|
||||
|
||||
/**
|
||||
|
|
@ -1048,9 +1055,9 @@ DLLExport MQTTResponse MQTTClient_subscribeMany5(MQTTClient handle, int count, c
|
|||
* An error code is returned if there was a problem removing the
|
||||
* subscription.
|
||||
*/
|
||||
DLLExport int MQTTClient_unsubscribe(MQTTClient handle, const char* topic);
|
||||
LIBMQTT_API int MQTTClient_unsubscribe(MQTTClient handle, const char* topic);
|
||||
|
||||
DLLExport MQTTResponse MQTTClient_unsubscribe5(MQTTClient handle, const char* topic, MQTTProperties* props);
|
||||
LIBMQTT_API MQTTResponse MQTTClient_unsubscribe5(MQTTClient handle, const char* topic, MQTTProperties* props);
|
||||
|
||||
/**
|
||||
* This function attempts to remove existing subscriptions to a list of topics
|
||||
|
|
@ -1063,9 +1070,9 @@ DLLExport MQTTResponse MQTTClient_unsubscribe5(MQTTClient handle, const char* to
|
|||
* @return ::MQTTCLIENT_SUCCESS if the subscriptions are removed.
|
||||
* An error code is returned if there was a problem removing the subscriptions.
|
||||
*/
|
||||
DLLExport int MQTTClient_unsubscribeMany(MQTTClient handle, int count, char* const* topic);
|
||||
LIBMQTT_API int MQTTClient_unsubscribeMany(MQTTClient handle, int count, char* const* topic);
|
||||
|
||||
DLLExport MQTTResponse MQTTClient_unsubscribeMany5(MQTTClient handle, int count, char* const* topic, MQTTProperties* props);
|
||||
LIBMQTT_API MQTTResponse MQTTClient_unsubscribeMany5(MQTTClient handle, int count, char* const* topic, MQTTProperties* props);
|
||||
|
||||
/**
|
||||
* This function attempts to publish a message to a given topic (see also
|
||||
|
|
@ -1088,10 +1095,10 @@ DLLExport MQTTResponse MQTTClient_unsubscribeMany5(MQTTClient handle, int count,
|
|||
* @return ::MQTTCLIENT_SUCCESS if the message is accepted for publication.
|
||||
* An error code is returned if there was a problem accepting the message.
|
||||
*/
|
||||
DLLExport int MQTTClient_publish(MQTTClient handle, const char* topicName, int payloadlen, const void* payload, int qos, int retained,
|
||||
MQTTClient_deliveryToken* dt);
|
||||
LIBMQTT_API int MQTTClient_publish(MQTTClient handle, const char* topicName, int payloadlen, const void* payload, int qos, int retained,
|
||||
MQTTClient_deliveryToken* dt);
|
||||
|
||||
DLLExport MQTTResponse MQTTClient_publish5(MQTTClient handle, const char* topicName, int payloadlen, const void* payload,
|
||||
LIBMQTT_API MQTTResponse MQTTClient_publish5(MQTTClient handle, const char* topicName, int payloadlen, const void* payload,
|
||||
int qos, int retained, MQTTProperties* properties, MQTTClient_deliveryToken* dt);
|
||||
/**
|
||||
* This function attempts to publish a message to a given topic (see also
|
||||
|
|
@ -1112,10 +1119,10 @@ DLLExport MQTTResponse MQTTClient_publish5(MQTTClient handle, const char* topicN
|
|||
* @return ::MQTTCLIENT_SUCCESS if the message is accepted for publication.
|
||||
* An error code is returned if there was a problem accepting the message.
|
||||
*/
|
||||
DLLExport int MQTTClient_publishMessage(MQTTClient handle, const char* topicName, MQTTClient_message* msg, MQTTClient_deliveryToken* dt);
|
||||
LIBMQTT_API int MQTTClient_publishMessage(MQTTClient handle, const char* topicName, MQTTClient_message* msg, MQTTClient_deliveryToken* dt);
|
||||
|
||||
|
||||
DLLExport MQTTResponse MQTTClient_publishMessage5(MQTTClient handle, const char* topicName, MQTTClient_message* msg,
|
||||
LIBMQTT_API MQTTResponse MQTTClient_publishMessage5(MQTTClient handle, const char* topicName, MQTTClient_message* msg,
|
||||
MQTTClient_deliveryToken* dt);
|
||||
|
||||
/**
|
||||
|
|
@ -1133,7 +1140,7 @@ DLLExport MQTTResponse MQTTClient_publishMessage5(MQTTClient handle, const char*
|
|||
* An error code is returned if the timeout expires or there was a problem
|
||||
* checking the token.
|
||||
*/
|
||||
DLLExport int MQTTClient_waitForCompletion(MQTTClient handle, MQTTClient_deliveryToken dt, unsigned long timeout);
|
||||
LIBMQTT_API int MQTTClient_waitForCompletion(MQTTClient handle, MQTTClient_deliveryToken dt, unsigned long timeout);
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -1154,7 +1161,7 @@ DLLExport int MQTTClient_waitForCompletion(MQTTClient handle, MQTTClient_deliver
|
|||
* An error code is returned if there was a problem obtaining the list of
|
||||
* pending tokens.
|
||||
*/
|
||||
DLLExport int MQTTClient_getPendingDeliveryTokens(MQTTClient handle, MQTTClient_deliveryToken **tokens);
|
||||
LIBMQTT_API int MQTTClient_getPendingDeliveryTokens(MQTTClient handle, MQTTClient_deliveryToken **tokens);
|
||||
|
||||
/**
|
||||
* When implementing a single-threaded client, call this function periodically
|
||||
|
|
@ -1162,7 +1169,7 @@ DLLExport int MQTTClient_getPendingDeliveryTokens(MQTTClient handle, MQTTClient_
|
|||
* If the application is calling MQTTClient_receive() regularly, then it is
|
||||
* not necessary to call this function.
|
||||
*/
|
||||
DLLExport void MQTTClient_yield(void);
|
||||
LIBMQTT_API void MQTTClient_yield(void);
|
||||
|
||||
/**
|
||||
* This function performs a synchronous receive of incoming messages. It should
|
||||
|
|
@ -1195,7 +1202,7 @@ DLLExport void MQTTClient_yield(void);
|
|||
* timeout expired, in which case <i>message</i> is NULL. An error code is
|
||||
* returned if there was a problem trying to receive a message.
|
||||
*/
|
||||
DLLExport int MQTTClient_receive(MQTTClient handle, char** topicName, int* topicLen, MQTTClient_message** message,
|
||||
LIBMQTT_API int MQTTClient_receive(MQTTClient handle, char** topicName, int* topicLen, MQTTClient_message** message,
|
||||
unsigned long timeout);
|
||||
|
||||
/**
|
||||
|
|
@ -1208,7 +1215,7 @@ DLLExport int MQTTClient_receive(MQTTClient handle, char** topicName, int* topic
|
|||
* @param msg The address of a pointer to the ::MQTTClient_message structure
|
||||
* to be freed.
|
||||
*/
|
||||
DLLExport void MQTTClient_freeMessage(MQTTClient_message** msg);
|
||||
LIBMQTT_API void MQTTClient_freeMessage(MQTTClient_message** msg);
|
||||
|
||||
/**
|
||||
* This function frees memory allocated by the MQTT C client library, especially the
|
||||
|
|
@ -1218,7 +1225,7 @@ DLLExport void MQTTClient_freeMessage(MQTTClient_message** msg);
|
|||
* allocated memory.
|
||||
* @param ptr The pointer to the client library storage to be freed.
|
||||
*/
|
||||
DLLExport void MQTTClient_free(void* ptr);
|
||||
LIBMQTT_API void MQTTClient_free(void* ptr);
|
||||
|
||||
/**
|
||||
* This function frees the memory allocated to an MQTT client (see
|
||||
|
|
@ -1227,7 +1234,7 @@ DLLExport void MQTTClient_free(void* ptr);
|
|||
* @param handle A pointer to the handle referring to the ::MQTTClient
|
||||
* structure to be freed.
|
||||
*/
|
||||
DLLExport void MQTTClient_destroy(MQTTClient* handle);
|
||||
LIBMQTT_API void MQTTClient_destroy(MQTTClient* handle);
|
||||
|
||||
|
||||
enum MQTTCLIENT_TRACE_LEVELS
|
||||
|
|
@ -1247,7 +1254,7 @@ enum MQTTCLIENT_TRACE_LEVELS
|
|||
* returned in the trace callback.
|
||||
* @param level the trace level required
|
||||
*/
|
||||
DLLExport void MQTTClient_setTraceLevel(enum MQTTCLIENT_TRACE_LEVELS level);
|
||||
LIBMQTT_API void MQTTClient_setTraceLevel(enum MQTTCLIENT_TRACE_LEVELS level);
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -1266,14 +1273,14 @@ typedef void MQTTClient_traceCallback(enum MQTTCLIENT_TRACE_LEVELS level, char*
|
|||
* MQTTASYNC_TRACE_MINIMUM.
|
||||
* @param callback a pointer to the function which will handle the trace information
|
||||
*/
|
||||
DLLExport void MQTTClient_setTraceCallback(MQTTClient_traceCallback* callback);
|
||||
LIBMQTT_API void MQTTClient_setTraceCallback(MQTTClient_traceCallback* callback);
|
||||
|
||||
/**
|
||||
* Returns a pointer to the string representation of the error or NULL.
|
||||
*
|
||||
* Do not free after use. Returns NULL if the error code is unknown.
|
||||
*/
|
||||
DLLExport const char* MQTTClient_strerror(int code);
|
||||
LIBMQTT_API const char* MQTTClient_strerror(int code);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
10
src/Thread.h
10
src/Thread.h
|
|
@ -56,14 +56,14 @@
|
|||
int Thread_destroy_cond(cond_type);
|
||||
#endif
|
||||
|
||||
DLLExport thread_type Thread_start(thread_fn, void*);
|
||||
LIBMQTT_API thread_type Thread_start(thread_fn, void*);
|
||||
|
||||
DLLExport mutex_type Thread_create_mutex();
|
||||
DLLExport int Thread_lock_mutex(mutex_type);
|
||||
DLLExport int Thread_unlock_mutex(mutex_type);
|
||||
LIBMQTT_API mutex_type Thread_create_mutex();
|
||||
LIBMQTT_API int Thread_lock_mutex(mutex_type);
|
||||
LIBMQTT_API int Thread_unlock_mutex(mutex_type);
|
||||
void Thread_destroy_mutex(mutex_type);
|
||||
|
||||
DLLExport thread_id_type Thread_getid();
|
||||
LIBMQTT_API thread_id_type Thread_getid();
|
||||
|
||||
sem_type Thread_create_sem(void);
|
||||
int Thread_wait_sem(sem_type sem, int timeout);
|
||||
|
|
|
|||
Loading…
Reference in New Issue