From 377e43fbb9ff48fc114c9c6ecc1b04796e01b0fb Mon Sep 17 00:00:00 2001
From: Gisle Vanem <gvanem@broadpark.no>
Date: Tue, 9 Nov 2004 14:00:56 +0000
Subject: [PATCH] Changes for removing libcurl.def file on Win32. Added
 "CURL_EXTERN" to memdebug.h functions. Cleaned up Makefile.vc6.

---
 lib/Makefile.am      | 17 ++++++++---------
 lib/Makefile.m32     | 20 +++++++-------------
 lib/Makefile.netware |  6 +++---
 lib/Makefile.vc6     | 21 +++++++++++----------
 lib/memdebug.h       | 40 +++++++++++++++++++++-------------------
 lib/strequal.h       |  6 +++++-
 6 files changed, 55 insertions(+), 55 deletions(-)

diff --git a/lib/Makefile.am b/lib/Makefile.am
index d5cca407fa..772a5f52b7 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -24,13 +24,12 @@ AUTOMAKE_OPTIONS = foreign nostdinc
 
 DSP = curllib.dsp
 
-EXTRA_DIST = Makefile.b32 Makefile.m32					\
-  Makefile.vc6 Makefile.riscos libcurl.def $(DSP) curllib.dsw		\
-  config-vms.h config-win32.h config-riscos.h config-mac.h config.h.in	\
-  ca-bundle.crt README.encoding README.memoryleak README.ares		\
-  README.curlx makefile.dj config.dj libcurl.framework.make		\
-  libcurl.plist libcurl.rc config-amigaos.h amigaos.c amigaos.h		\
-  makefile.amiga Makefile.netware nwlib.c libcurl.imp			\
+EXTRA_DIST = Makefile.b32 Makefile.m32 Makefile.vc6 Makefile.riscos $(DSP) \
+  curllib.dsw config-vms.h config-win32.h config-win32ce.h config-riscos.h \
+  config-mac.h config.h.in ca-bundle.crt README.encoding                   \
+  README.memoryleak README.ares README.curlx makefile.dj config.dj         \
+  libcurl.framework.make libcurl.plist libcurl.rc config-amigaos.h         \
+  amigaos.c amigaos.h makefile.amiga Makefile.netware nwlib.c libcurl.imp  \
   msvcproj.head msvcproj.foot config-win32ce.h
 
 CLEANFILES = $(DSP)
@@ -51,7 +50,7 @@ VERSION=-version-info 3:0:0
 # If either revision or age are omitted, they default to 0. Also note that age
 # must be less than or equal to the current interface number.
 #
-# Here are a set of rules to help you update your library version information: 
+# Here are a set of rules to help you update your library version information:
 #
 # 1.Start with version information of 0:0:0 for each libtool library.
 #
@@ -90,7 +89,7 @@ include Makefile.inc
 
 libcurl_la_SOURCES = $(CSOURCES) $(HHEADERS)
 
-WIN32SOURCES = $(CSOURCES) libcurl.def
+WIN32SOURCES = $(CSOURCES)
 WIN32HEADERS = $(HHEADERS) config-win32.h
 
 BUILT_SOURCES = $(top_builddir)/lib/ca-bundle.h
diff --git a/lib/Makefile.m32 b/lib/Makefile.m32
index ec7bf90858..d5cbe3ce6e 100644
--- a/lib/Makefile.m32
+++ b/lib/Makefile.m32
@@ -18,15 +18,15 @@ endif
 
 CC = gcc
 AR = ar
-RM = rm -f 
+RM = rm -f
 RANLIB = ranlib
 STRIP = strip -g
 
 ########################################################
 ## Nothing more to do below this line!
 
-INCLUDES = -I. -I.. -I../include -I../src
-CFLAGS = -g -O2 -DMINGW32
+INCLUDES = -I. -I../include
+CFLAGS = -g -O2 -DMINGW32 -DBUILDING_LIBCURL
 ifdef SSL
   INCLUDES += -I"$(OPENSSL_PATH)/outinc" -I"$(OPENSSL_PATH)/outinc/openssl"
   CFLAGS += -DUSE_SSLEAY -DHAVE_OPENSSL_ENGINE_H
@@ -59,22 +59,16 @@ RESOURCE = libcurl.res
 
 # remove the last line above to keep debug info
 
-libcurl.dll libcurldll.a: libcurl.a libcurl.def $(RESOURCE)
+libcurl.dll libcurldll.a: $(libcurl_a_OBJECTS) $(RESOURCE)
 	$(RM) $@
-	dllwrap --dllname $@ --output-lib libcurldll.a --export-all --def libcurl.def $(libcurl_a_LIBRARIES) $(RESOURCE) $(DLL_LIBS) -lwsock32 -lws2_32 -lwinmm
-	$(STRIP) $@
+	$(CC) -s -shared -Wl,--out-implib,libcurldll.a -o libcurl.dll \
+	  $(libcurl_a_OBJECTS) $(RESOURCE) $(DLL_LIBS) -lws2_32 -lwinmm
 
-# remove the last line above to keep debug info
+# remove the above '-s' to keep debug info
 
 .c.o:
 	$(COMPILE) -c $<
 
-.s.o:
-	$(COMPILE) -c $<
-
-.S.o:
-	$(COMPILE) -c $<
-
 libcurl.res: libcurl.rc
 	windres -DCURLDEBUG=0 -O COFF -o $@ -i $^
 
diff --git a/lib/Makefile.netware b/lib/Makefile.netware
index a63ac63ed3..2f3391b548 100644
--- a/lib/Makefile.netware
+++ b/lib/Makefile.netware
@@ -70,7 +70,7 @@ CP	= cp -afv
 MPKXDC	= mkxdc
 
 # Global flags for all compilers
-CFLAGS	= $(OPT) -D$(DB) -DNETWARE -DHAVE_CONFIG_H -nostdinc
+CFLAGS	= $(OPT) -D$(DB) -DNETWARE -DHAVE_CONFIG_H -DBUILDING_LIBCURL -nostdinc
 
 ifeq ($(CC),mwccnlm)
 LD	= mwldnlm
@@ -164,9 +164,9 @@ OBJL	= $(OBJS) $(OBJDIR)/nwlib.o
 
 all: lib nlm
 
-nlm: prebuild $(TARGET).nlm 
+nlm: prebuild $(TARGET).nlm
 
-lib: prebuild $(TARGET).lib 
+lib: prebuild $(TARGET).lib
 
 prebuild: $(OBJDIR) $(OBJDIR)/version.inc config.h ca-bundle.h
 
diff --git a/lib/Makefile.vc6 b/lib/Makefile.vc6
index 1436bb310a..45e679dc35 100644
--- a/lib/Makefile.vc6
+++ b/lib/Makefile.vc6
@@ -39,20 +39,20 @@ USEMM_LIBS = YES
 #############################################################
 ## Nothing more to do below this line!
 
-CCNODBG    = cl.exe /MD /O2 /D "NDEBUG"
-CCDEBUG    = cl.exe /MDd /Od /Gm /Zi  /D "_DEBUG" /GZ
-CFLAGSSSL  = /D "USE_SSLEAY" /I "$(OPENSSL_PATH)/inc32" /I "$(OPENSSL_PATH)/inc32/openssl"
-CFLAGSZLIB = /D "HAVE_ZLIB_H" /D "HAVE_ZLIB" /D "HAVE_LIBZ" /I "$(ZLIB_PATH)"
-CFLAGS     = /I "." /I "../include" /nologo /W3 /GX /D "WIN32" /D "VC6" /D "_MBCS" /D "_LIB" /YX /FD /c /D "MSDOS" 
-LNKDLL     = link.exe /DLL  /def:libcurl.def
+CCNODBG    = cl.exe /MD /O2 /DNDEBUG
+CCDEBUG    = cl.exe /MDd /Od /Gm /Zi /D_DEBUG /GZ
+CFLAGSSSL  = /DUSE_SSLEAY /I "$(OPENSSL_PATH)/inc32" /I "$(OPENSSL_PATH)/inc32/openssl"
+CFLAGSZLIB = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ /I "$(ZLIB_PATH)"
+CFLAGS     = /I. /I../include /nologo /W3 /GX /DWIN32 /DVC6 /D_MBCS /D_LIB /YX /FD /c /DBUILDING_LIBCURL
+LNKDLL     = link.exe /DLL
 LNKLIB     = link.exe /lib
 LFLAGS     = /nologo
 SSLLIBS    = libeay32.lib ssleay32.lib
 !IFDEF USEMM_LIBS
 WINLIBS    = wsock32.lib winmm.lib
 !ELSE
-WINLIBS    = wsock32.lib 
-CFLAGS     = $(CFLAGS) /D "WITHOUT_MM_LIB"
+WINLIBS    = wsock32.lib
+CFLAGS     = $(CFLAGS) /DWITHOUT_MM_LIB
 !ENDIF
 #  RSAglue.lib was formerly needed in the SSLLIBS
 CFGSET     = FALSE
@@ -112,7 +112,7 @@ TARGET   =$(LIB_NAME).dll
 DIROBJ   =.\$(CFG)
 LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)/out32dll"
 LNK      = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(WINLIBS) $(LFLAGSSSL) /out:$(TARGET) /IMPLIB:"$(LIB_NAME).lib"
-CC       = $(CCNODBG)  $(CFLAGSSSL)
+CC       = $(CCNODBG) $(CFLAGSSSL)
 CFGSET   = TRUE
 RESOURCE = $(DIROBJ)\libcurl.res
 !ENDIF
@@ -136,7 +136,7 @@ TARGET   =$(LIB_NAME).lib
 DIROBJ   =.\$(CFG)
 LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)/out32dll"
 LNK      = $(LNKLIB) $(SSLLIBS) $(LFLAGSSSL) /out:$(TARGET)
-CC       = $(CCNODBG)  $(CFLAGSSSL)
+CC       = $(CCNODBG) $(CFLAGSSSL)
 CFGSET   = TRUE
 RESOURCE = $(DIROBJ)\libcurl.res
 !ENDIF
@@ -272,6 +272,7 @@ X_OBJS= \
         $(DIROBJ)\http_negotiate.obj \
         $(DIROBJ)\http_ntlm.obj \
 	$(DIROBJ)\md5.obj \
+	$(DIROBJ)\memdebug.obj \
 	$(DIROBJ)\strerror.obj \
 	$(DIROBJ)\content_encoding.obj \
 	$(RESOURCE)
diff --git a/lib/memdebug.h b/lib/memdebug.h
index 42574cf439..b8ac6a8707 100644
--- a/lib/memdebug.h
+++ b/lib/memdebug.h
@@ -2,10 +2,10 @@
 #ifndef _CURL_MEDEBUG_H
 #define _CURL_MEDEBUG_H
 /***************************************************************************
- *                                  _   _ ____  _     
- *  Project                     ___| | | |  _ \| |    
- *                             / __| | | | |_) | |    
- *                            | (__| |_| |  _ <| |___ 
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
  * Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
@@ -13,7 +13,7 @@
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
  * are also available at http://curl.haxx.se/docs/copyright.html.
- * 
+ *
  * 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
  * furnished to do so, under the terms of the COPYING file.
@@ -31,6 +31,8 @@
 
 #include "setup.h"
 
+#include <curl/curl.h>
+
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
@@ -48,24 +50,24 @@
 extern FILE *logfile;
 
 /* memory functions */
-void *curl_domalloc(size_t size, int line, const char *source);
-void *curl_docalloc(size_t elements, size_t size, int line, const char *source);
-void *curl_dorealloc(void *ptr, size_t size, int line, const char *source);
-void curl_dofree(void *ptr, int line, const char *source);
-char *curl_dostrdup(const char *str, int line, const char *source);
-void curl_memdebug(const char *logname);
-void curl_memlimit(long limit);
+CURL_EXTERN void *curl_domalloc(size_t size, int line, const char *source);
+CURL_EXTERN void *curl_docalloc(size_t elements, size_t size, int line, const char *source);
+CURL_EXTERN void *curl_dorealloc(void *ptr, size_t size, int line, const char *source);
+CURL_EXTERN void curl_dofree(void *ptr, int line, const char *source);
+CURL_EXTERN char *curl_dostrdup(const char *str, int line, const char *source);
+CURL_EXTERN void curl_memdebug(const char *logname);
+CURL_EXTERN void curl_memlimit(long limit);
 
 /* file descriptor manipulators */
-int curl_socket(int domain, int type, int protocol, int line , const char *);
-int curl_sclose(int sockfd, int, const char *source);
-int curl_accept(int s, void *addr, void *addrlen,
-                int line, const char *source);
+CURL_EXTERN int curl_socket(int domain, int type, int protocol, int line , const char *);
+CURL_EXTERN int curl_sclose(int sockfd, int, const char *source);
+CURL_EXTERN int curl_accept(int s, void *addr, void *addrlen,
+                            int line, const char *source);
 
 /* FILE functions */
-FILE *curl_fopen(const char *file, const char *mode, int line,
-                 const char *source);
-int curl_fclose(FILE *file, int line, const char *source);
+CURL_EXTERN FILE *curl_fopen(const char *file, const char *mode, int line,
+                             const char *source);
+CURL_EXTERN int curl_fclose(FILE *file, int line, const char *source);
 
 #ifndef MEMDEBUG_NODEFINES
 
diff --git a/lib/strequal.h b/lib/strequal.h
index 5865211758..b3be070c31 100644
--- a/lib/strequal.h
+++ b/lib/strequal.h
@@ -23,11 +23,15 @@
  * $Id$
  ***************************************************************************/
 
+#include <curl/curl.h>
+
+#if 0
 /*
- * These two actually are public functions.
+ * These two actually are public functions, which are in <curl/curl.h>
  */
 int curl_strequal(const char *first, const char *second);
 int curl_strnequal(const char *first, const char *second, size_t max);
+#endif
 
 #define strequal(a,b) curl_strequal(a,b)
 #define strnequal(a,b,c) curl_strnequal(a,b,c)
-- 
GitLab