From 0bb8339b8eee079cf95d5ed8a16d64f23de04736 Mon Sep 17 00:00:00 2001 From: ygrek Date: Wed, 20 Jan 2010 18:32:39 +0200 Subject: [PATCH] tweak code and Makefile for msvc build --- Makefile.windows | 14 ++++++++------ curl-helper.c | 11 +++++++++-- examples/Makefile.windows | 8 +++++--- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/Makefile.windows b/Makefile.windows index 6a3bfe8..2a85ebd 100644 --- a/Makefile.windows +++ b/Makefile.windows @@ -15,8 +15,10 @@ CC = cl FLAGS = LIBS = -CFLAGS = #/Ic:/devtools/ocaml/lib/caml /Ic:/devtools/curl/include -CAMLINCDIR = -I c:/devtools/ocaml/lib/caml -I c:/devtools/curl/include +CURLDIR = c:/my/contrib/curl-7.19.7 + +CFLAGS = +CAMLINCDIR = -I $(CURLDIR)/include CURLHELPEROBJS = curl-helper.obj CURLOBJS = curl.cmx @@ -34,7 +36,7 @@ all: targets: $(TARGETS) examples examples: - (cd examples; $(MAKE) -f Makefile.windows) + $(MAKE) -C examples -f Makefile.windows curl.cma: $(CURLBCOBJS) libcurl-helper.lib $(OCBYTE) -custom -a $(FLAGS) $(CURLFLAGS) -o $@ $(CURLBCOBJS) $(CURLCLIBS) @@ -55,11 +57,11 @@ libcurl-helper.lib: $(CURLHELPEROBJS) lib /OUT:libcurl-helper.lib $(CURLHELPEROBJS) .c.obj: - $(OC) -c $(CFLAGS) $(CAMLINCDIR) $< -o $@ + $(OC) -c $(CFLAGS) -ccopt -DHAVE_CONFIG_H $(CAMLINCDIR) $< -o $@ clean: - @rm -f $(TARGETS) *~ *.cm* *.o *.a .depend core - @(cd examples; $(MAKE) -f Makefile.windows clean) + @del $(TARGETS) *~ *.cm* *.o *.a *.obj *.lib .depend core + @$(MAKE) -C examples -f Makefile.windows clean depend: @ocamldep *.mli *.ml > .depend diff --git a/curl-helper.c b/curl-helper.c index 3501005..626ecab 100644 --- a/curl-helper.c +++ b/curl-helper.c @@ -22,12 +22,18 @@ #warning "No config file given." #endif +#if defined(_MSC_VER) +#ifdef interface +#undef interface +#endif +#endif + void leave_blocking_section(void); void enter_blocking_section(void); #define Val_none Val_int(0) -static inline value +static __inline value Val_some( value v ) { CAMLparam1( v ); @@ -5814,6 +5820,7 @@ CAMLprim value caml_curlm_remove_finished(value v_multi) static int curlm_wait_data(CURLM* multi_handle) { struct timeval timeout; + CURLMcode ret; fd_set fdread; fd_set fdwrite; @@ -5829,7 +5836,7 @@ static int curlm_wait_data(CURLM* multi_handle) timeout.tv_usec = 0; /* get file descriptors from the transfers */ - CURLMcode ret = curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); + ret = curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); if (ret == CURLM_OK && maxfd >= 0) { diff --git a/examples/Makefile.windows b/examples/Makefile.windows index 7c47be9..3bde89a 100644 --- a/examples/Makefile.windows +++ b/examples/Makefile.windows @@ -10,9 +10,11 @@ OCOPT = ocamlopt OC = ocamlc CC = ocamlc +CURLDIR = C:/my/contrib/curl-7.19.7 + FLAGS = -I .. -LFLAGS = -I .. -cclib "/link /LIBPATH:c:/devtools/curl" -LIBS = libcurl.lib +LFLAGS = -I .. -cclib "-L$(CURLDIR)" +LIBS = libcurl_imp.lib OCURLLIB = curl.cma OCURLOPTLIB = curl.cmxa @@ -41,7 +43,7 @@ targets: $(TARGETS) $(OCBYTE) -c $(FLAGS) $< -o $@ clean: - @rm -f $(TARGETS) *~ *.cm* *.o *.a .depend core + @del $(TARGETS) *~ *.cm* *.o *.a *.obj *.lib .depend core depend: @ocamldep *.mli *.ml > .depend -- 2.11.4.GIT