Changes for removing libcurl.def file on Win32.

Mark public functions with "CURL_EXTERN".
This commit is contained in:
Gisle Vanem 2004-11-09 14:02:58 +00:00
parent 377e43fbb9
commit 3ccbed1022
4 changed files with 83 additions and 66 deletions

View File

@ -47,6 +47,21 @@ typedef void CURL;
extern "C" { extern "C" {
#endif #endif
/*
* Decorate exportable functions for Win32 and Netware DLL linking.
* This avoids using a .def file for building libcurl.dll.
*/
#if (defined(WIN32) || defined(_WIN32) || defined(NETWARE)) && \
!defined(CURL_STATICLIB)
#if defined(BUILDING_LIBCURL)
#define CURL_EXTERN __declspec(dllexport)
#else
#define CURL_EXTERN __declspec(dllimport)
#endif
#else
#define CURL_EXTERN
#endif
/* /*
* We want the typedef curl_off_t setup for large file support on all * We want the typedef curl_off_t setup for large file support on all
* platforms. We also provide a CURL_FORMAT_OFF_T define to use in *printf * platforms. We also provide a CURL_FORMAT_OFF_T define to use in *printf
@ -921,8 +936,8 @@ typedef enum {
/* curl_strequal() and curl_strnequal() are subject for removal in a future /* curl_strequal() and curl_strnequal() are subject for removal in a future
libcurl, see lib/README.curlx for details */ libcurl, see lib/README.curlx for details */
extern int (curl_strequal)(const char *s1, const char *s2); CURL_EXTERN int (curl_strequal)(const char *s1, const char *s2);
extern int (curl_strnequal)(const char *s1, const char *s2, size_t n); CURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n);
/* name is uppercase CURLFORM_<name> */ /* name is uppercase CURLFORM_<name> */
#ifdef CFINIT #ifdef CFINIT
@ -1011,9 +1026,9 @@ typedef enum {
* adds one part that together construct a full post. Then use * adds one part that together construct a full post. Then use
* CURLOPT_HTTPPOST to send it off to libcurl. * CURLOPT_HTTPPOST to send it off to libcurl.
*/ */
CURLFORMcode curl_formadd(struct curl_httppost **httppost, CURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost,
struct curl_httppost **last_post, struct curl_httppost **last_post,
...); ...);
/* /*
* NAME curl_formfree() * NAME curl_formfree()
@ -1022,7 +1037,7 @@ CURLFORMcode curl_formadd(struct curl_httppost **httppost,
* *
* Free a multipart formpost previously built with curl_formadd(). * Free a multipart formpost previously built with curl_formadd().
*/ */
void curl_formfree(struct curl_httppost *form); CURL_EXTERN void curl_formfree(struct curl_httppost *form);
/* /*
* NAME curl_getenv() * NAME curl_getenv()
@ -1032,7 +1047,7 @@ void curl_formfree(struct curl_httppost *form);
* Returns a malloc()'ed string that MUST be curl_free()ed after usage is * Returns a malloc()'ed string that MUST be curl_free()ed after usage is
* complete. DEPRECATED - see lib/README.curlx * complete. DEPRECATED - see lib/README.curlx
*/ */
char *curl_getenv(const char *variable); CURL_EXTERN char *curl_getenv(const char *variable);
/* /*
* NAME curl_version() * NAME curl_version()
@ -1041,7 +1056,7 @@ char *curl_getenv(const char *variable);
* *
* Returns a static ascii string of the libcurl version. * Returns a static ascii string of the libcurl version.
*/ */
char *curl_version(void); CURL_EXTERN char *curl_version(void);
/* /*
* NAME curl_escape() * NAME curl_escape()
@ -1052,7 +1067,7 @@ char *curl_version(void);
* %XX versions). This function returns a new allocated string or NULL if an * %XX versions). This function returns a new allocated string or NULL if an
* error occurred. * error occurred.
*/ */
char *curl_escape(const char *string, int length); CURL_EXTERN char *curl_escape(const char *string, int length);
/* /*
* NAME curl_unescape() * NAME curl_unescape()
@ -1063,7 +1078,7 @@ char *curl_escape(const char *string, int length);
* versions). This function returns a new allocated string or NULL if an error * versions). This function returns a new allocated string or NULL if an error
* occurred. * occurred.
*/ */
char *curl_unescape(const char *string, int length); CURL_EXTERN char *curl_unescape(const char *string, int length);
/* /*
* NAME curl_free() * NAME curl_free()
@ -1073,7 +1088,7 @@ char *curl_unescape(const char *string, int length);
* Provided for de-allocation in the same translation unit that did the * Provided for de-allocation in the same translation unit that did the
* allocation. Added in libcurl 7.10 * allocation. Added in libcurl 7.10
*/ */
void curl_free(void *p); CURL_EXTERN void curl_free(void *p);
/* /*
* NAME curl_global_init() * NAME curl_global_init()
@ -1083,7 +1098,7 @@ void curl_free(void *p);
* curl_global_init() should be invoked exactly once for each application that * curl_global_init() should be invoked exactly once for each application that
* uses libcurl * uses libcurl
*/ */
CURLcode curl_global_init(long flags); CURL_EXTERN CURLcode curl_global_init(long flags);
/* /*
* NAME curl_global_init_mem() * NAME curl_global_init_mem()
@ -1098,12 +1113,12 @@ CURLcode curl_global_init(long flags);
* callback routines with be invoked by this library instead of the system * callback routines with be invoked by this library instead of the system
* memory management routines like malloc, free etc. * memory management routines like malloc, free etc.
*/ */
CURLcode curl_global_init_mem(long flags, CURL_EXTERN CURLcode curl_global_init_mem(long flags,
curl_malloc_callback m, curl_malloc_callback m,
curl_free_callback f, curl_free_callback f,
curl_realloc_callback r, curl_realloc_callback r,
curl_strdup_callback s, curl_strdup_callback s,
curl_calloc_callback c); curl_calloc_callback c);
/* /*
* NAME curl_global_cleanup() * NAME curl_global_cleanup()
@ -1113,7 +1128,7 @@ CURLcode curl_global_init_mem(long flags,
* curl_global_cleanup() should be invoked exactly once for each application * curl_global_cleanup() should be invoked exactly once for each application
* that uses libcurl * that uses libcurl
*/ */
void curl_global_cleanup(void); CURL_EXTERN void curl_global_cleanup(void);
/* linked-list structure for the CURLOPT_QUOTE option (and other) */ /* linked-list structure for the CURLOPT_QUOTE option (and other) */
struct curl_slist { struct curl_slist {
@ -1129,7 +1144,8 @@ struct curl_slist {
* Appends a string to a linked list. If no list exists, it will be created * Appends a string to a linked list. If no list exists, it will be created
* first. Returns the new list, after appending. * first. Returns the new list, after appending.
*/ */
struct curl_slist *curl_slist_append(struct curl_slist *, const char *); CURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *,
const char *);
/* /*
* NAME curl_slist_free_all() * NAME curl_slist_free_all()
@ -1138,7 +1154,7 @@ struct curl_slist *curl_slist_append(struct curl_slist *, const char *);
* *
* free a previously built curl_slist. * free a previously built curl_slist.
*/ */
void curl_slist_free_all(struct curl_slist *); CURL_EXTERN void curl_slist_free_all(struct curl_slist *);
/* /*
* NAME curl_getdate() * NAME curl_getdate()
@ -1150,7 +1166,7 @@ void curl_slist_free_all(struct curl_slist *);
* where the specified time is relative now, like 'two weeks' or 'tomorrow' * where the specified time is relative now, like 'two weeks' or 'tomorrow'
* etc. * etc.
*/ */
time_t curl_getdate(const char *p, const time_t *now); CURL_EXTERN time_t curl_getdate(const char *p, const time_t *now);
#define CURLINFO_STRING 0x100000 #define CURLINFO_STRING 0x100000
#define CURLINFO_LONG 0x200000 #define CURLINFO_LONG 0x200000
@ -1271,9 +1287,9 @@ typedef enum {
CURLSHOPT_LAST /* never use */ CURLSHOPT_LAST /* never use */
} CURLSHoption; } CURLSHoption;
CURLSH *curl_share_init(void); CURL_EXTERN CURLSH *curl_share_init(void);
CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...); CURL_EXTERN CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...);
CURLSHcode curl_share_cleanup(CURLSH *); CURL_EXTERN CURLSHcode curl_share_cleanup(CURLSH *);
/**************************************************************************** /****************************************************************************
* Structures for querying information about the curl library at runtime. * Structures for querying information about the curl library at runtime.
@ -1333,7 +1349,7 @@ typedef struct {
* This function returns a pointer to a static copy of the version info * This function returns a pointer to a static copy of the version info
* struct. See above. * struct. See above.
*/ */
curl_version_info_data *curl_version_info(CURLversion); CURL_EXTERN curl_version_info_data *curl_version_info(CURLversion);
/* /*
* NAME curl_easy_strerror() * NAME curl_easy_strerror()
@ -1344,7 +1360,7 @@ curl_version_info_data *curl_version_info(CURLversion);
* into the equivalent human readable error string. This is useful * into the equivalent human readable error string. This is useful
* for printing meaningful error messages. * for printing meaningful error messages.
*/ */
const char *curl_easy_strerror(CURLcode); CURL_EXTERN const char *curl_easy_strerror(CURLcode);
/* /*
* NAME curl_share_strerror() * NAME curl_share_strerror()
@ -1355,7 +1371,7 @@ const char *curl_easy_strerror(CURLcode);
* into the equivalent human readable error string. This is useful * into the equivalent human readable error string. This is useful
* for printing meaningful error messages. * for printing meaningful error messages.
*/ */
const char *curl_share_strerror(CURLSHcode); CURL_EXTERN const char *curl_share_strerror(CURLSHcode);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -26,10 +26,10 @@
extern "C" { extern "C" {
#endif #endif
CURL *curl_easy_init(void); CURL_EXTERN CURL *curl_easy_init(void);
CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...); CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
CURLcode curl_easy_perform(CURL *curl); CURL_EXTERN CURLcode curl_easy_perform(CURL *curl);
void curl_easy_cleanup(CURL *curl); CURL_EXTERN void curl_easy_cleanup(CURL *curl);
/* /*
* NAME curl_easy_getinfo() * NAME curl_easy_getinfo()
@ -44,7 +44,7 @@ void curl_easy_cleanup(CURL *curl);
* performed transfer, all results from this function are undefined until the * performed transfer, all results from this function are undefined until the
* transfer is completed. * transfer is completed.
*/ */
CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...); CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
/* /*
@ -59,7 +59,7 @@ CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
* curl_easy_duphandle() for each new thread to avoid a series of identical * curl_easy_duphandle() for each new thread to avoid a series of identical
* curl_easy_setopt() invokes in every thread. * curl_easy_setopt() invokes in every thread.
*/ */
CURL* curl_easy_duphandle(CURL *curl); CURL_EXTERN CURL* curl_easy_duphandle(CURL *curl);
/* /*
* NAME curl_easy_reset() * NAME curl_easy_reset()
@ -72,7 +72,7 @@ CURL* curl_easy_duphandle(CURL *curl);
* It does keep: live connections, the Session ID cache, the DNS cache and the * It does keep: live connections, the Session ID cache, the DNS cache and the
* cookies. * cookies.
*/ */
void curl_easy_reset(CURL *curl); CURL_EXTERN void curl_easy_reset(CURL *curl);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -1,8 +1,8 @@
/*************************************************************************** /***************************************************************************
* _ _ ____ _ * _ _ ____ _
* Project ___| | | | _ \| | * Project ___| | | | _ \| |
* / __| | | | |_) | | * / __| | | | |_) | |
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
@ -10,7 +10,7 @@
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html. * are also available at http://curl.haxx.se/docs/copyright.html.
* *
* You may opt to use, copy, modify, merge, publish, distribute and/or sell * You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is * copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file. * furnished to do so, under the terms of the COPYING file.
@ -26,17 +26,18 @@
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> /* needed for FILE */ #include <stdio.h> /* needed for FILE */
#include <curl/curl.h>
int curl_mprintf(const char *format, ...); CURL_EXTERN int curl_mprintf(const char *format, ...);
int curl_mfprintf(FILE *fd, const char *format, ...); CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...);
int curl_msprintf(char *buffer, const char *format, ...); CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...);
int curl_msnprintf(char *buffer, size_t maxlength, const char *format, ...); CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength, const char *format, ...);
int curl_mvprintf(const char *format, va_list args); CURL_EXTERN int curl_mvprintf(const char *format, va_list args);
int curl_mvfprintf(FILE *fd, const char *format, va_list args); CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args);
int curl_mvsprintf(char *buffer, const char *format, va_list args); CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args);
int curl_mvsnprintf(char *buffer, size_t maxlength, const char *format, va_list args); CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength, const char *format, va_list args);
char *curl_maprintf(const char *format, ...); CURL_EXTERN char *curl_maprintf(const char *format, ...);
char *curl_mvaprintf(const char *format, va_list args); CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args);
#ifdef _MPRINTF_REPLACE #ifdef _MPRINTF_REPLACE
# define printf curl_mprintf # define printf curl_mprintf

View File

@ -113,7 +113,7 @@ typedef struct CURLMsg CURLMsg;
* Desc: inititalize multi-style curl usage * Desc: inititalize multi-style curl usage
* Returns: a new CURLM handle to use in all 'curl_multi' functions. * Returns: a new CURLM handle to use in all 'curl_multi' functions.
*/ */
CURLM *curl_multi_init(void); CURL_EXTERN CURLM *curl_multi_init(void);
/* /*
* Name: curl_multi_add_handle() * Name: curl_multi_add_handle()
@ -121,8 +121,8 @@ CURLM *curl_multi_init(void);
* Desc: add a standard curl handle to the multi stack * Desc: add a standard curl handle to the multi stack
* Returns: CURLMcode type, general multi error code. * Returns: CURLMcode type, general multi error code.
*/ */
CURLMcode curl_multi_add_handle(CURLM *multi_handle, CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle,
CURL *curl_handle); CURL *curl_handle);
/* /*
* Name: curl_multi_remove_handle() * Name: curl_multi_remove_handle()
@ -130,8 +130,8 @@ CURLMcode curl_multi_add_handle(CURLM *multi_handle,
* Desc: removes a curl handle from the multi stack again * Desc: removes a curl handle from the multi stack again
* Returns: CURLMcode type, general multi error code. * Returns: CURLMcode type, general multi error code.
*/ */
CURLMcode curl_multi_remove_handle(CURLM *multi_handle, CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
CURL *curl_handle); CURL *curl_handle);
/* /*
* Name: curl_multi_fdset() * Name: curl_multi_fdset()
@ -141,11 +141,11 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
* them are ready. * them are ready.
* Returns: CURLMcode type, general multi error code. * Returns: CURLMcode type, general multi error code.
*/ */
CURLMcode curl_multi_fdset(CURLM *multi_handle, CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle,
fd_set *read_fd_set, fd_set *read_fd_set,
fd_set *write_fd_set, fd_set *write_fd_set,
fd_set *exc_fd_set, fd_set *exc_fd_set,
int *max_fd); int *max_fd);
/* /*
* Name: curl_multi_perform() * Name: curl_multi_perform()
@ -163,8 +163,8 @@ CURLMcode curl_multi_fdset(CURLM *multi_handle,
* still have occurred problems on invidual transfers even when this * still have occurred problems on invidual transfers even when this
* returns OK. * returns OK.
*/ */
CURLMcode curl_multi_perform(CURLM *multi_handle, CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle,
int *running_handles); int *running_handles);
/* /*
* Name: curl_multi_cleanup() * Name: curl_multi_cleanup()
@ -175,7 +175,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle,
* in the middle of a transfer. * in the middle of a transfer.
* Returns: CURLMcode type, general multi error code. * Returns: CURLMcode type, general multi error code.
*/ */
CURLMcode curl_multi_cleanup(CURLM *multi_handle); CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle);
/* /*
* Name: curl_multi_info_read() * Name: curl_multi_info_read()
@ -205,8 +205,8 @@ CURLMcode curl_multi_cleanup(CURLM *multi_handle);
* queue (after this read) in the integer the second argument points * queue (after this read) in the integer the second argument points
* to. * to.
*/ */
CURLMsg *curl_multi_info_read(CURLM *multi_handle, CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle,
int *msgs_in_queue); int *msgs_in_queue);
/* /*
* NAME curl_multi_strerror() * NAME curl_multi_strerror()
@ -217,7 +217,7 @@ CURLMsg *curl_multi_info_read(CURLM *multi_handle,
* into the equivalent human readable error string. This is useful * into the equivalent human readable error string. This is useful
* for printing meaningful error messages. * for printing meaningful error messages.
*/ */
const char *curl_multi_strerror(CURLMcode); CURL_EXTERN const char *curl_multi_strerror(CURLMcode);
#ifdef __cplusplus #ifdef __cplusplus
} /* end of extern "C" */ } /* end of extern "C" */