diff options
author | Rosen Penev | 2021-05-07 02:26:24 -0700 |
---|---|---|
committer | Nikias Bassen | 2023-05-05 02:52:00 +0200 |
commit | 14102fb7ef8737965c97836560eb3a287f480a25 (patch) | |
tree | 263e9cba1b88073a1d68d7e54d1a49bf47fdcaf2 /src | |
parent | 28be9537a632625deaa7d71979ebf725b1b9bbc2 (diff) | |
download | libirecovery-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 'src')
-rw-r--r-- | src/libirecovery.c | 88 |
1 files changed, 39 insertions, 49 deletions
diff --git a/src/libirecovery.c b/src/libirecovery.c index 8ebc9fa..6edb948 100644 --- a/src/libirecovery.c +++ b/src/libirecovery.c @@ -57,16 +57,6 @@ #endif #endif -#ifdef WIN32 -#define IRECV_API __declspec( dllexport ) -#else -#ifdef HAVE_FVISIBILITY -#define IRECV_API __attribute__((visibility("default"))) -#else -#define IRECV_API -#endif -#endif - #include "libirecovery.h" struct irecv_client_private { @@ -1040,14 +1030,14 @@ static int check_context(irecv_client_t client) { } #endif -IRECV_API void irecv_init(void) +void irecv_init(void) { #ifndef USE_DUMMY thread_once(&init_once, _irecv_init); #endif } -IRECV_API void irecv_exit(void) +void irecv_exit(void) { #ifndef USE_DUMMY thread_once(&deinit_once, _irecv_deinit); @@ -1089,7 +1079,7 @@ static int iokit_usb_control_transfer(irecv_client_t client, uint8_t bm_request_ #endif #endif -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) { +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) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; #else @@ -1199,7 +1189,7 @@ static int iokit_usb_bulk_transfer(irecv_client_t client, #endif #endif -IRECV_API int irecv_usb_bulk_transfer(irecv_client_t client, +int irecv_usb_bulk_transfer(irecv_client_t client, unsigned char endpoint, unsigned char *data, int length, @@ -1420,7 +1410,7 @@ static irecv_error_t iokit_open_with_ecid(irecv_client_t* pclient, uint64_t ecid #endif #endif -IRECV_API irecv_error_t irecv_open_with_ecid(irecv_client_t* pclient, uint64_t ecid) { +irecv_error_t irecv_open_with_ecid(irecv_client_t* pclient, uint64_t ecid) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; #else @@ -1573,7 +1563,7 @@ IRECV_API irecv_error_t irecv_open_with_ecid(irecv_client_t* pclient, uint64_t e #endif } -IRECV_API irecv_error_t irecv_usb_set_configuration(irecv_client_t client, int configuration) { +irecv_error_t irecv_usb_set_configuration(irecv_client_t client, int configuration) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; #else @@ -1689,7 +1679,7 @@ static irecv_error_t iokit_usb_set_interface(irecv_client_t client, int usb_inte #endif #endif -IRECV_API irecv_error_t irecv_usb_set_interface(irecv_client_t client, int usb_interface, int usb_alt_interface) { +irecv_error_t irecv_usb_set_interface(irecv_client_t client, int usb_interface, int usb_alt_interface) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; #else @@ -1725,7 +1715,7 @@ IRECV_API irecv_error_t irecv_usb_set_interface(irecv_client_t client, int usb_i #endif } -IRECV_API irecv_error_t irecv_reset(irecv_client_t client) { +irecv_error_t irecv_reset(irecv_client_t client) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; #else @@ -1758,7 +1748,7 @@ IRECV_API irecv_error_t irecv_reset(irecv_client_t client) { #endif } -IRECV_API irecv_error_t irecv_open_with_ecid_and_attempts(irecv_client_t* pclient, uint64_t ecid, int attempts) { +irecv_error_t irecv_open_with_ecid_and_attempts(irecv_client_t* pclient, uint64_t ecid, int attempts) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; #else @@ -1781,7 +1771,7 @@ IRECV_API irecv_error_t irecv_open_with_ecid_and_attempts(irecv_client_t* pclien #endif } -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_error_t irecv_event_subscribe(irecv_client_t client, irecv_event_type type, irecv_event_cb_t callback, void* user_data) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; #else @@ -1818,7 +1808,7 @@ IRECV_API irecv_error_t irecv_event_subscribe(irecv_client_t client, irecv_event #endif } -IRECV_API irecv_error_t irecv_event_unsubscribe(irecv_client_t client, irecv_event_type type) { +irecv_error_t irecv_event_unsubscribe(irecv_client_t client, irecv_event_type type) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; #else @@ -2426,7 +2416,7 @@ static void *_irecv_event_handler(void* data) } #endif /* !USE_DUMMY */ -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_error_t irecv_device_event_subscribe(irecv_device_event_context_t *context, irecv_device_event_cb_t callback, void *user_data) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; @@ -2472,7 +2462,7 @@ IRECV_API irecv_error_t irecv_device_event_subscribe(irecv_device_event_context_ #endif } -IRECV_API irecv_error_t irecv_device_event_unsubscribe(irecv_device_event_context_t context) +irecv_error_t irecv_device_event_unsubscribe(irecv_device_event_context_t context) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; @@ -2524,7 +2514,7 @@ IRECV_API irecv_error_t irecv_device_event_unsubscribe(irecv_device_event_contex #endif } -IRECV_API irecv_error_t irecv_close(irecv_client_t client) { +irecv_error_t irecv_close(irecv_client_t client) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; #else @@ -2580,7 +2570,7 @@ IRECV_API irecv_error_t irecv_close(irecv_client_t client) { #endif } -IRECV_API void irecv_set_debug_level(int level) { +void irecv_set_debug_level(int level) { libirecovery_debug = level; #ifndef USE_DUMMY #ifndef WIN32 @@ -2612,7 +2602,7 @@ static irecv_error_t irecv_send_command_raw(irecv_client_t client, const char* c } #endif -IRECV_API irecv_error_t irecv_send_command_breq(irecv_client_t client, const char* command, uint8_t b_request) { +irecv_error_t irecv_send_command_breq(irecv_client_t client, const char* command, uint8_t b_request) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; #else @@ -2656,11 +2646,11 @@ IRECV_API irecv_error_t irecv_send_command_breq(irecv_client_t client, const cha #endif } -IRECV_API irecv_error_t irecv_send_command(irecv_client_t client, const char* command) { +irecv_error_t irecv_send_command(irecv_client_t client, const char* command) { return irecv_send_command_breq(client, command, 0); } -IRECV_API irecv_error_t irecv_send_file(irecv_client_t client, const char* filename, int dfu_notify_finished) { +irecv_error_t irecv_send_file(irecv_client_t client, const char* filename, int dfu_notify_finished) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; #else @@ -2719,7 +2709,7 @@ static irecv_error_t irecv_get_status(irecv_client_t client, unsigned int* statu } #endif -IRECV_API irecv_error_t irecv_send_buffer(irecv_client_t client, unsigned char* buffer, unsigned long length, int dfu_notify_finished) { +irecv_error_t irecv_send_buffer(irecv_client_t client, unsigned char* buffer, unsigned long length, int dfu_notify_finished) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; #else @@ -2886,7 +2876,7 @@ IRECV_API irecv_error_t irecv_send_buffer(irecv_client_t client, unsigned char* #endif } -IRECV_API irecv_error_t irecv_receive(irecv_client_t client) { +irecv_error_t irecv_receive(irecv_client_t client) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; #else @@ -2920,7 +2910,7 @@ IRECV_API irecv_error_t irecv_receive(irecv_client_t client) { #endif } -IRECV_API irecv_error_t irecv_getenv(irecv_client_t client, const char* variable, char** value) { +irecv_error_t irecv_getenv(irecv_client_t client, const char* variable, char** value) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; #else @@ -2960,7 +2950,7 @@ IRECV_API irecv_error_t irecv_getenv(irecv_client_t client, const char* variable #endif } -IRECV_API irecv_error_t irecv_getret(irecv_client_t client, unsigned int* value) { +irecv_error_t irecv_getret(irecv_client_t client, unsigned int* value) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; #else @@ -2983,7 +2973,7 @@ IRECV_API irecv_error_t irecv_getret(irecv_client_t client, unsigned int* value) #endif } -IRECV_API irecv_error_t irecv_get_mode(irecv_client_t client, int* mode) { +irecv_error_t irecv_get_mode(irecv_client_t client, int* mode) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; #else @@ -2996,7 +2986,7 @@ IRECV_API irecv_error_t irecv_get_mode(irecv_client_t client, int* mode) { #endif } -IRECV_API const struct irecv_device_info* irecv_get_device_info(irecv_client_t client) +const struct irecv_device_info* irecv_get_device_info(irecv_client_t client) { #ifdef USE_DUMMY return NULL; @@ -3024,7 +3014,7 @@ static void *iokit_limera1n_usb_submit_request(void *argv) { #endif #endif -IRECV_API irecv_error_t irecv_trigger_limera1n_exploit(irecv_client_t client) { +irecv_error_t irecv_trigger_limera1n_exploit(irecv_client_t client) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; #else @@ -3075,7 +3065,7 @@ IRECV_API irecv_error_t irecv_trigger_limera1n_exploit(irecv_client_t client) { #endif } -IRECV_API irecv_error_t irecv_execute_script(irecv_client_t client, const char* script) { +irecv_error_t irecv_execute_script(irecv_client_t client, const char* script) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; #else @@ -3107,7 +3097,7 @@ IRECV_API irecv_error_t irecv_execute_script(irecv_client_t client, const char* #endif } -IRECV_API irecv_error_t irecv_saveenv(irecv_client_t client) { +irecv_error_t irecv_saveenv(irecv_client_t client) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; #else @@ -3120,7 +3110,7 @@ IRECV_API irecv_error_t irecv_saveenv(irecv_client_t client) { #endif } -IRECV_API irecv_error_t irecv_setenv(irecv_client_t client, const char* variable, const char* value) { +irecv_error_t irecv_setenv(irecv_client_t client, const char* variable, const char* value) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; #else @@ -3144,7 +3134,7 @@ IRECV_API irecv_error_t irecv_setenv(irecv_client_t client, const char* variable #endif } -IRECV_API irecv_error_t irecv_setenv_np(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) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; #else @@ -3168,7 +3158,7 @@ IRECV_API irecv_error_t irecv_setenv_np(irecv_client_t client, const char* varia #endif } -IRECV_API irecv_error_t irecv_reboot(irecv_client_t client) { +irecv_error_t irecv_reboot(irecv_client_t client) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; #else @@ -3181,7 +3171,7 @@ IRECV_API irecv_error_t irecv_reboot(irecv_client_t client) { #endif } -IRECV_API const char* irecv_strerror(irecv_error_t error) { +const char* irecv_strerror(irecv_error_t error) { switch (error) { case IRECV_E_SUCCESS: return "Command completed successfully"; @@ -3229,7 +3219,7 @@ IRECV_API const char* irecv_strerror(irecv_error_t error) { return NULL; } -IRECV_API irecv_error_t irecv_reset_counters(irecv_client_t client) { +irecv_error_t irecv_reset_counters(irecv_client_t client) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; #else @@ -3244,7 +3234,7 @@ IRECV_API irecv_error_t irecv_reset_counters(irecv_client_t client) { #endif } -IRECV_API irecv_error_t irecv_recv_buffer(irecv_client_t client, char* buffer, unsigned long length) { +irecv_error_t irecv_recv_buffer(irecv_client_t client, char* buffer, unsigned long length) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; #else @@ -3290,7 +3280,7 @@ IRECV_API irecv_error_t irecv_recv_buffer(irecv_client_t client, char* buffer, u #endif } -IRECV_API irecv_error_t irecv_finish_transfer(irecv_client_t client) { +irecv_error_t irecv_finish_transfer(irecv_client_t client) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; #else @@ -3312,11 +3302,11 @@ IRECV_API irecv_error_t irecv_finish_transfer(irecv_client_t client) { #endif } -IRECV_API irecv_device_t irecv_devices_get_all(void) { +irecv_device_t irecv_devices_get_all(void) { return irecv_devices; } -IRECV_API 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_client(irecv_client_t client, irecv_device_t* device) { #ifdef USE_DUMMY return IRECV_E_UNSUPPORTED; #else @@ -3342,7 +3332,7 @@ IRECV_API irecv_error_t irecv_devices_get_device_by_client(irecv_client_t client #endif } -IRECV_API 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_product_type(const char* product_type, irecv_device_t* device) { int i = 0; if (!product_type || !device) @@ -3360,7 +3350,7 @@ IRECV_API irecv_error_t irecv_devices_get_device_by_product_type(const char* pro return IRECV_E_NO_DEVICE; } -IRECV_API irecv_error_t irecv_devices_get_device_by_hardware_model(const char* hardware_model, irecv_device_t* device) { +irecv_error_t irecv_devices_get_device_by_hardware_model(const char* hardware_model, irecv_device_t* device) { int i = 0; if (!hardware_model || !device) @@ -3378,7 +3368,7 @@ IRECV_API irecv_error_t irecv_devices_get_device_by_hardware_model(const char* h return IRECV_E_NO_DEVICE; } -IRECV_API irecv_client_t irecv_reconnect(irecv_client_t client, int initial_pause) { +irecv_client_t irecv_reconnect(irecv_client_t client, int initial_pause) { #ifdef USE_DUMMY return NULL; #else |