summaryrefslogtreecommitdiff
path: root/librabbitmq
diff options
context:
space:
mode:
authorAlan Antonuk <alan.antonuk@gmail.com>2021-04-06 07:20:36 +0000
committerAlan Antonuk <alan.antonuk@gmail.com>2021-04-06 00:29:38 -0700
commit5d1fd824227f8eb20b1ac2eb63d6533d7479556a (patch)
tree9734516781323016d7b2568268bdaa804a7666c8 /librabbitmq
parentc8c117097934c9d2ecab30ce70efba98f0e267f8 (diff)
downloadrabbitmq-c-5d1fd824227f8eb20b1ac2eb63d6533d7479556a.tar.gz
cmake: use GenerateExportHeader for AMQP_EXPORT
Use cmake's GenerateExportHeader to define AMQP_EXPORT & AMQP_DEPRECATED over the one in amqp.h. This is likely to be more correct over time. Note this requires bumping the minimum required version from v3.10 to v3.12 to pick up support in CMake for C libraries. Signed-off-by: GitHub <noreply@github.com>
Diffstat (limited to 'librabbitmq')
-rw-r--r--librabbitmq/CMakeLists.txt10
-rw-r--r--librabbitmq/amqp_framing.c38
-rw-r--r--librabbitmq/codegen.py28
3 files changed, 43 insertions, 33 deletions
diff --git a/librabbitmq/CMakeLists.txt b/librabbitmq/CMakeLists.txt
index 84a6363..16a5d4e 100644
--- a/librabbitmq/CMakeLists.txt
+++ b/librabbitmq/CMakeLists.txt
@@ -56,6 +56,7 @@ include_directories(${LIBRABBITMQ_INCLUDE_DIRS})
set(LIBRABBITMQ_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/../include
+ ${CMAKE_CURRENT_BINARY_DIR}
PARENT_SCOPE)
add_definitions(-DHAVE_CONFIG_H)
@@ -162,6 +163,14 @@ if (BUILD_STATIC_LIBS)
endif ()
endif (BUILD_STATIC_LIBS)
+include(GenerateExportHeader)
+generate_export_header(${RMQ_LIBRARY_TARGET}
+ BASE_NAME AMQP
+ EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/rabbitmq-c/export.h
+ STATIC_DEFINE AMQP_STATIC
+ INCLUDE_GUARD_NAME RABBITMQ_C_EXPORT_H
+)
+
install(FILES
../include/amqp.h
../include/amqp_framing.h
@@ -174,6 +183,7 @@ install(FILES
../include/rabbitmq-c/framing.h
../include/rabbitmq-c/tcp_socket.h
${AMQP_SSL_SOCKET_H_PATH}
+ ${CMAKE_CURRENT_BINARY_DIR}/rabbitmq-c/export.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rabbitmq-c
)
diff --git a/librabbitmq/amqp_framing.c b/librabbitmq/amqp_framing.c
index bdeb01c..7d36889 100644
--- a/librabbitmq/amqp_framing.c
+++ b/librabbitmq/amqp_framing.c
@@ -2440,7 +2440,7 @@ int amqp_encode_properties(uint16_t class_id, void *decoded,
* @param [in] channel the channel to do the RPC on
* @returns amqp_channel_open_ok_t
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
amqp_channel_open_ok_t *AMQP_CALL
amqp_channel_open(amqp_connection_state_t state, amqp_channel_t channel) {
amqp_channel_open_t req;
@@ -2458,7 +2458,7 @@ amqp_channel_open_ok_t *AMQP_CALL
* @param [in] active active
* @returns amqp_channel_flow_ok_t
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
amqp_channel_flow_ok_t *AMQP_CALL
amqp_channel_flow(amqp_connection_state_t state, amqp_channel_t channel,
amqp_boolean_t active) {
@@ -2483,7 +2483,7 @@ amqp_channel_flow_ok_t *AMQP_CALL
* @param [in] arguments arguments
* @returns amqp_exchange_declare_ok_t
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
amqp_exchange_declare_ok_t *AMQP_CALL amqp_exchange_declare(
amqp_connection_state_t state, amqp_channel_t channel,
amqp_bytes_t exchange, amqp_bytes_t type, amqp_boolean_t passive,
@@ -2513,7 +2513,7 @@ amqp_exchange_declare_ok_t *AMQP_CALL amqp_exchange_declare(
* @param [in] if_unused if_unused
* @returns amqp_exchange_delete_ok_t
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
amqp_exchange_delete_ok_t *AMQP_CALL
amqp_exchange_delete(amqp_connection_state_t state, amqp_channel_t channel,
amqp_bytes_t exchange, amqp_boolean_t if_unused) {
@@ -2538,7 +2538,7 @@ amqp_exchange_delete_ok_t *AMQP_CALL
* @param [in] arguments arguments
* @returns amqp_exchange_bind_ok_t
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
amqp_exchange_bind_ok_t *AMQP_CALL
amqp_exchange_bind(amqp_connection_state_t state, amqp_channel_t channel,
amqp_bytes_t destination, amqp_bytes_t source,
@@ -2566,7 +2566,7 @@ amqp_exchange_bind_ok_t *AMQP_CALL
* @param [in] arguments arguments
* @returns amqp_exchange_unbind_ok_t
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
amqp_exchange_unbind_ok_t *AMQP_CALL
amqp_exchange_unbind(amqp_connection_state_t state, amqp_channel_t channel,
amqp_bytes_t destination, amqp_bytes_t source,
@@ -2596,7 +2596,7 @@ amqp_exchange_unbind_ok_t *AMQP_CALL
* @param [in] arguments arguments
* @returns amqp_queue_declare_ok_t
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
amqp_queue_declare_ok_t *AMQP_CALL amqp_queue_declare(
amqp_connection_state_t state, amqp_channel_t channel, amqp_bytes_t queue,
amqp_boolean_t passive, amqp_boolean_t durable, amqp_boolean_t exclusive,
@@ -2626,7 +2626,7 @@ amqp_queue_declare_ok_t *AMQP_CALL amqp_queue_declare(
* @param [in] arguments arguments
* @returns amqp_queue_bind_ok_t
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
amqp_queue_bind_ok_t *AMQP_CALL amqp_queue_bind(
amqp_connection_state_t state, amqp_channel_t channel, amqp_bytes_t queue,
amqp_bytes_t exchange, amqp_bytes_t routing_key, amqp_table_t arguments) {
@@ -2650,7 +2650,7 @@ amqp_queue_bind_ok_t *AMQP_CALL amqp_queue_bind(
* @param [in] queue queue
* @returns amqp_queue_purge_ok_t
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
amqp_queue_purge_ok_t *AMQP_CALL amqp_queue_purge(amqp_connection_state_t state,
amqp_channel_t channel,
amqp_bytes_t queue) {
@@ -2673,7 +2673,7 @@ amqp_queue_purge_ok_t *AMQP_CALL amqp_queue_purge(amqp_connection_state_t state,
* @param [in] if_empty if_empty
* @returns amqp_queue_delete_ok_t
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
amqp_queue_delete_ok_t *AMQP_CALL amqp_queue_delete(
amqp_connection_state_t state, amqp_channel_t channel, amqp_bytes_t queue,
amqp_boolean_t if_unused, amqp_boolean_t if_empty) {
@@ -2699,7 +2699,7 @@ amqp_queue_delete_ok_t *AMQP_CALL amqp_queue_delete(
* @param [in] arguments arguments
* @returns amqp_queue_unbind_ok_t
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
amqp_queue_unbind_ok_t *AMQP_CALL amqp_queue_unbind(
amqp_connection_state_t state, amqp_channel_t channel, amqp_bytes_t queue,
amqp_bytes_t exchange, amqp_bytes_t routing_key, amqp_table_t arguments) {
@@ -2724,7 +2724,7 @@ amqp_queue_unbind_ok_t *AMQP_CALL amqp_queue_unbind(
* @param [in] global global
* @returns amqp_basic_qos_ok_t
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
amqp_basic_qos_ok_t *AMQP_CALL amqp_basic_qos(amqp_connection_state_t state,
amqp_channel_t channel,
uint32_t prefetch_size,
@@ -2752,7 +2752,7 @@ amqp_basic_qos_ok_t *AMQP_CALL amqp_basic_qos(amqp_connection_state_t state,
* @param [in] arguments arguments
* @returns amqp_basic_consume_ok_t
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
amqp_basic_consume_ok_t *AMQP_CALL amqp_basic_consume(
amqp_connection_state_t state, amqp_channel_t channel, amqp_bytes_t queue,
amqp_bytes_t consumer_tag, amqp_boolean_t no_local, amqp_boolean_t no_ack,
@@ -2779,7 +2779,7 @@ amqp_basic_consume_ok_t *AMQP_CALL amqp_basic_consume(
* @param [in] consumer_tag consumer_tag
* @returns amqp_basic_cancel_ok_t
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
amqp_basic_cancel_ok_t *AMQP_CALL
amqp_basic_cancel(amqp_connection_state_t state, amqp_channel_t channel,
amqp_bytes_t consumer_tag) {
@@ -2799,7 +2799,7 @@ amqp_basic_cancel_ok_t *AMQP_CALL
* @param [in] requeue requeue
* @returns amqp_basic_recover_ok_t
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
amqp_basic_recover_ok_t *AMQP_CALL
amqp_basic_recover(amqp_connection_state_t state, amqp_channel_t channel,
amqp_boolean_t requeue) {
@@ -2817,7 +2817,7 @@ amqp_basic_recover_ok_t *AMQP_CALL
* @param [in] channel the channel to do the RPC on
* @returns amqp_tx_select_ok_t
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
amqp_tx_select_ok_t *AMQP_CALL amqp_tx_select(amqp_connection_state_t state,
amqp_channel_t channel) {
amqp_tx_select_t req;
@@ -2833,7 +2833,7 @@ amqp_tx_select_ok_t *AMQP_CALL amqp_tx_select(amqp_connection_state_t state,
* @param [in] channel the channel to do the RPC on
* @returns amqp_tx_commit_ok_t
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
amqp_tx_commit_ok_t *AMQP_CALL amqp_tx_commit(amqp_connection_state_t state,
amqp_channel_t channel) {
amqp_tx_commit_t req;
@@ -2849,7 +2849,7 @@ amqp_tx_commit_ok_t *AMQP_CALL amqp_tx_commit(amqp_connection_state_t state,
* @param [in] channel the channel to do the RPC on
* @returns amqp_tx_rollback_ok_t
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
amqp_tx_rollback_ok_t *AMQP_CALL amqp_tx_rollback(amqp_connection_state_t state,
amqp_channel_t channel) {
amqp_tx_rollback_t req;
@@ -2865,7 +2865,7 @@ amqp_tx_rollback_ok_t *AMQP_CALL amqp_tx_rollback(amqp_connection_state_t state,
* @param [in] channel the channel to do the RPC on
* @returns amqp_confirm_select_ok_t
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
amqp_confirm_select_ok_t *AMQP_CALL
amqp_confirm_select(amqp_connection_state_t state, amqp_channel_t channel) {
amqp_confirm_select_t req;
diff --git a/librabbitmq/codegen.py b/librabbitmq/codegen.py
index 3ae24b6..a9e4e07 100644
--- a/librabbitmq/codegen.py
+++ b/librabbitmq/codegen.py
@@ -263,7 +263,7 @@ def methodApiPrototype(m):
docs += " * @returns %s_ok_t\n" % (fn)
docs += " */\n"
- return "%sAMQP_PUBLIC_FUNCTION\n%s_ok_t *\nAMQP_CALL %s(amqp_connection_state_t state, amqp_channel_t channel%s)" % (docs, fn, fn, ''.join(args))
+ return "%sAMQP_EXPORT\n%s_ok_t *\nAMQP_CALL %s(amqp_connection_state_t state, amqp_channel_t channel%s)" % (docs, fn, fn, ''.join(args))
AmqpMethod.apiPrototype = methodApiPrototype
@@ -599,11 +599,11 @@ def genHrl(spec):
* ***** END LICENSE BLOCK *****
*/
-/** @file amqp_framing.h */
-#ifndef AMQP_FRAMING_H
-#define AMQP_FRAMING_H
+/** @file rabbitmq-c/framing.h */
+#ifndef RABBITMQ_C_FRAMING_H
+#define RABBITMQ_C_FRAMING_H
-#include <amqp.h>
+#include <rabbitmq-c/amqp.h>
AMQP_BEGIN_DECLS
"""
@@ -625,7 +625,7 @@ AMQP_BEGIN_DECLS
* @returns string describing the constant. String is managed by
* the library and should not be free()'d by the program
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
char const *
AMQP_CALL amqp_constant_name(int constantNumber);
@@ -638,7 +638,7 @@ AMQP_CALL amqp_constant_name(int constantNumber);
* @param [in] constantNumber the error constant
* @returns true if its a hard error, false otherwise
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
amqp_boolean_t
AMQP_CALL amqp_constant_is_hard_error(int constantNumber);
@@ -649,7 +649,7 @@ AMQP_CALL amqp_constant_is_hard_error(int constantNumber);
* @returns method name string. String is managed by the library
* and should not be freed()'d by the program
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
char const *
AMQP_CALL amqp_method_name(amqp_method_number_t methodNumber);
@@ -662,7 +662,7 @@ AMQP_CALL amqp_method_name(amqp_method_number_t methodNumber);
* @param [in] methodNumber the method number
* @returns true if method has content, false otherwise
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
amqp_boolean_t
AMQP_CALL amqp_method_has_content(amqp_method_number_t methodNumber);
@@ -675,7 +675,7 @@ AMQP_CALL amqp_method_has_content(amqp_method_number_t methodNumber);
* @param [out] decoded pointer to the decoded method struct
* @returns 0 on success, an error code otherwise
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
int
AMQP_CALL amqp_decode_method(amqp_method_number_t methodNumber,
amqp_pool_t *pool,
@@ -691,7 +691,7 @@ AMQP_CALL amqp_decode_method(amqp_method_number_t methodNumber,
* @param [out] decoded pointer to the decoded properties struct
* @returns 0 on success, an error code otherwise
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
int
AMQP_CALL amqp_decode_properties(uint16_t class_id,
amqp_pool_t *pool,
@@ -708,7 +708,7 @@ AMQP_CALL amqp_decode_properties(uint16_t class_id,
* to hold the encoded method, an error code will be returned.
* @returns 0 on success, an error code otherwise.
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
int
AMQP_CALL amqp_encode_method(amqp_method_number_t methodNumber,
void *decoded,
@@ -724,7 +724,7 @@ AMQP_CALL amqp_encode_method(amqp_method_number_t methodNumber,
* an error code will be returned
* @returns 0 on success, an error code otherwise.
*/
-AMQP_PUBLIC_FUNCTION
+AMQP_EXPORT
int
AMQP_CALL amqp_encode_properties(uint16_t class_id,
void *decoded,
@@ -773,7 +773,7 @@ AMQP_CALL amqp_encode_properties(uint16_t class_id,
print """
AMQP_END_DECLS
-#endif /* AMQP_FRAMING_H */"""
+#endif /* RABBITMQ_C_FRAMING_H */"""
def generateErl(specPath):
genErl(AmqpSpec(specPath))