summaryrefslogtreecommitdiffstats
path: root/include/libirecovery.h
diff options
context:
space:
mode:
authorGravatar Rosen Penev2021-05-07 02:26:24 -0700
committerGravatar Nikias Bassen2023-05-05 02:52:00 +0200
commit14102fb7ef8737965c97836560eb3a287f480a25 (patch)
tree263e9cba1b88073a1d68d7e54d1a49bf47fdcaf2 /include/libirecovery.h
parent28be9537a632625deaa7d71979ebf725b1b9bbc2 (diff)
downloadlibirecovery-14102fb7ef8737965c97836560eb3a287f480a25.tar.gz
libirecovery-14102fb7ef8737965c97836560eb3a287f480a25.tar.bz2
move IRECV_API into the headers
clang + lld + ucrt on Windows seems to require that the dllimport attribute be applied to the first declaration. Fixes -Wdll-attribute-on-declaration error. Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'include/libirecovery.h')
-rw-r--r--include/libirecovery.h88
1 files changed, 49 insertions, 39 deletions
diff --git a/include/libirecovery.h b/include/libirecovery.h
index a33e49a..94522d7 100644
--- a/include/libirecovery.h
+++ b/include/libirecovery.h
@@ -27,6 +27,16 @@ extern "C" {
#include <stdint.h>
+#ifdef WIN32
+#define IRECV_API __declspec( dllexport )
+#else
+#ifdef HAVE_FVISIBILITY
+#define IRECV_API __attribute__((visibility("default")))
+#else
+#define IRECV_API
+#endif
+#endif
+
enum irecv_mode {
IRECV_K_RECOVERY_MODE_1 = 0x1280,
IRECV_K_RECOVERY_MODE_2 = 0x1281,
@@ -111,64 +121,64 @@ typedef struct irecv_client_private irecv_client_private;
typedef irecv_client_private* irecv_client_t;
/* library */
-void irecv_set_debug_level(int level);
-const char* irecv_strerror(irecv_error_t error);
-void irecv_init(void); /* deprecated: libirecovery has constructor now */
-void irecv_exit(void); /* deprecated: libirecovery has destructor now */
+IRECV_API void irecv_set_debug_level(int level);
+IRECV_API const char* irecv_strerror(irecv_error_t error);
+IRECV_API void irecv_init(void); /* deprecated: libirecovery has constructor now */
+IRECV_API void irecv_exit(void); /* deprecated: libirecovery has destructor now */
/* device connectivity */
-irecv_error_t irecv_open_with_ecid(irecv_client_t* client, uint64_t ecid);
-irecv_error_t irecv_open_with_ecid_and_attempts(irecv_client_t* pclient, uint64_t ecid, int attempts);
-irecv_error_t irecv_reset(irecv_client_t client);
-irecv_error_t irecv_close(irecv_client_t client);
-irecv_client_t irecv_reconnect(irecv_client_t client, int initial_pause);
+IRECV_API irecv_error_t irecv_open_with_ecid(irecv_client_t* client, uint64_t ecid);
+IRECV_API irecv_error_t irecv_open_with_ecid_and_attempts(irecv_client_t* pclient, uint64_t ecid, int attempts);
+IRECV_API irecv_error_t irecv_reset(irecv_client_t client);
+IRECV_API irecv_error_t irecv_close(irecv_client_t client);
+IRECV_API irecv_client_t irecv_reconnect(irecv_client_t client, int initial_pause);
/* misc */
-irecv_error_t irecv_receive(irecv_client_t client);
-irecv_error_t irecv_execute_script(irecv_client_t client, const char* script);
-irecv_error_t irecv_reset_counters(irecv_client_t client);
-irecv_error_t irecv_finish_transfer(irecv_client_t client);
-irecv_error_t irecv_trigger_limera1n_exploit(irecv_client_t client);
+IRECV_API irecv_error_t irecv_receive(irecv_client_t client);
+IRECV_API irecv_error_t irecv_execute_script(irecv_client_t client, const char* script);
+IRECV_API irecv_error_t irecv_reset_counters(irecv_client_t client);
+IRECV_API irecv_error_t irecv_finish_transfer(irecv_client_t client);
+IRECV_API irecv_error_t irecv_trigger_limera1n_exploit(irecv_client_t client);
/* usb helpers */
-irecv_error_t irecv_usb_set_configuration(irecv_client_t client, int configuration);
-irecv_error_t irecv_usb_set_interface(irecv_client_t client, int usb_interface, int usb_alt_interface);
-int irecv_usb_control_transfer(irecv_client_t client, uint8_t bm_request_type, uint8_t b_request, uint16_t w_value, uint16_t w_index, unsigned char *data, uint16_t w_length, unsigned int timeout);
-int irecv_usb_bulk_transfer(irecv_client_t client, unsigned char endpoint, unsigned char *data, int length, int *transferred, unsigned int timeout);
+IRECV_API irecv_error_t irecv_usb_set_configuration(irecv_client_t client, int configuration);
+IRECV_API irecv_error_t irecv_usb_set_interface(irecv_client_t client, int usb_interface, int usb_alt_interface);
+IRECV_API int irecv_usb_control_transfer(irecv_client_t client, uint8_t bm_request_type, uint8_t b_request, uint16_t w_value, uint16_t w_index, unsigned char *data, uint16_t w_length, unsigned int timeout);
+IRECV_API int irecv_usb_bulk_transfer(irecv_client_t client, unsigned char endpoint, unsigned char *data, int length, int *transferred, unsigned int timeout);
/* events */
typedef void(*irecv_device_event_cb_t)(const irecv_device_event_t* event, void *user_data);
typedef struct irecv_device_event_context* irecv_device_event_context_t;
-irecv_error_t irecv_device_event_subscribe(irecv_device_event_context_t *context, irecv_device_event_cb_t callback, void *user_data);
-irecv_error_t irecv_device_event_unsubscribe(irecv_device_event_context_t context);
+IRECV_API irecv_error_t irecv_device_event_subscribe(irecv_device_event_context_t *context, irecv_device_event_cb_t callback, void *user_data);
+IRECV_API irecv_error_t irecv_device_event_unsubscribe(irecv_device_event_context_t context);
typedef int(*irecv_event_cb_t)(irecv_client_t client, const irecv_event_t* event);
-irecv_error_t irecv_event_subscribe(irecv_client_t client, irecv_event_type type, irecv_event_cb_t callback, void *user_data);
-irecv_error_t irecv_event_unsubscribe(irecv_client_t client, irecv_event_type type);
+IRECV_API irecv_error_t irecv_event_subscribe(irecv_client_t client, irecv_event_type type, irecv_event_cb_t callback, void *user_data);
+IRECV_API irecv_error_t irecv_event_unsubscribe(irecv_client_t client, irecv_event_type type);
/* I/O */
-irecv_error_t irecv_send_file(irecv_client_t client, const char* filename, int dfu_notify_finished);
-irecv_error_t irecv_send_command(irecv_client_t client, const char* command);
-irecv_error_t irecv_send_command_breq(irecv_client_t client, const char* command, uint8_t b_request);
-irecv_error_t irecv_send_buffer(irecv_client_t client, unsigned char* buffer, unsigned long length, int dfu_notify_finished);
-irecv_error_t irecv_recv_buffer(irecv_client_t client, char* buffer, unsigned long length);
+IRECV_API irecv_error_t irecv_send_file(irecv_client_t client, const char* filename, int dfu_notify_finished);
+IRECV_API irecv_error_t irecv_send_command(irecv_client_t client, const char* command);
+IRECV_API irecv_error_t irecv_send_command_breq(irecv_client_t client, const char* command, uint8_t b_request);
+IRECV_API irecv_error_t irecv_send_buffer(irecv_client_t client, unsigned char* buffer, unsigned long length, int dfu_notify_finished);
+IRECV_API irecv_error_t irecv_recv_buffer(irecv_client_t client, char* buffer, unsigned long length);
/* commands */
-irecv_error_t irecv_saveenv(irecv_client_t client);
-irecv_error_t irecv_getenv(irecv_client_t client, const char* variable, char** value);
-irecv_error_t irecv_setenv(irecv_client_t client, const char* variable, const char* value);
-irecv_error_t irecv_setenv_np(irecv_client_t client, const char* variable, const char* value);
-irecv_error_t irecv_reboot(irecv_client_t client);
-irecv_error_t irecv_getret(irecv_client_t client, unsigned int* value);
+IRECV_API irecv_error_t irecv_saveenv(irecv_client_t client);
+IRECV_API irecv_error_t irecv_getenv(irecv_client_t client, const char* variable, char** value);
+IRECV_API irecv_error_t irecv_setenv(irecv_client_t client, const char* variable, const char* value);
+IRECV_API irecv_error_t irecv_setenv_np(irecv_client_t client, const char* variable, const char* value);
+IRECV_API irecv_error_t irecv_reboot(irecv_client_t client);
+IRECV_API irecv_error_t irecv_getret(irecv_client_t client, unsigned int* value);
/* device information */
-irecv_error_t irecv_get_mode(irecv_client_t client, int* mode);
-const struct irecv_device_info* irecv_get_device_info(irecv_client_t client);
+IRECV_API irecv_error_t irecv_get_mode(irecv_client_t client, int* mode);
+IRECV_API const struct irecv_device_info* irecv_get_device_info(irecv_client_t client);
/* device database queries */
-irecv_device_t irecv_devices_get_all(void);
-irecv_error_t irecv_devices_get_device_by_client(irecv_client_t client, irecv_device_t* device);
-irecv_error_t irecv_devices_get_device_by_product_type(const char* product_type, irecv_device_t* device);
-irecv_error_t irecv_devices_get_device_by_hardware_model(const char* hardware_model, irecv_device_t* device);
+IRECV_API irecv_device_t irecv_devices_get_all(void);
+IRECV_API irecv_error_t irecv_devices_get_device_by_client(irecv_client_t client, irecv_device_t* device);
+IRECV_API irecv_error_t irecv_devices_get_device_by_product_type(const char* product_type, irecv_device_t* device);
+IRECV_API irecv_error_t irecv_devices_get_device_by_hardware_model(const char* hardware_model, irecv_device_t* device);
#ifdef __cplusplus
}