Restore Cygwin64 support

master
David Allsopp 2020-09-21 13:36:03 +01:00
parent 37d6394874
commit 001c2d1283
6 changed files with 21 additions and 6 deletions

View File

@ -485,6 +485,9 @@ Working version
it with -link. it with -link.
(David Allsopp, review by Xavier Leroy) (David Allsopp, review by Xavier Leroy)
- #9927: Restore Cygwin64 support.
(David Allsopp, review by Xavier Leroy)
OCaml 4.11.1 OCaml 4.11.1
------------ ------------

View File

@ -466,7 +466,8 @@ let link_bytecode_as_c tolink outfile with_main =
(fun () -> (fun () ->
(* The bytecode *) (* The bytecode *)
output_string outchan "\ output_string outchan "\
#define CAML_INTERNALS\ #define CAML_INTERNALS\n\
#define CAMLDLLIMPORT\
\n\ \n\
\n#ifdef __cplusplus\ \n#ifdef __cplusplus\
\nextern \"C\" {\ \nextern \"C\" {\

View File

@ -35,7 +35,9 @@
#endif #endif
#include "caml/sys.h" #include "caml/sys.h"
#include "caml/memprof.h" #include "caml/memprof.h"
#include "threads.h"
/* threads.h is *not* included since it contains the _external_ declarations for
the caml_c_thread_register and caml_c_thread_unregister functions. */
#if defined(NATIVE_CODE) && defined(WITH_SPACETIME) #if defined(NATIVE_CODE) && defined(WITH_SPACETIME)
#include "caml/spacetime.h" #include "caml/spacetime.h"

View File

@ -130,6 +130,8 @@ ifneq "$(CCOMPTYPE)" "msvc"
OC_CFLAGS += -g OC_CFLAGS += -g
endif endif
OC_CPPFLAGS += -DCAMLDLLIMPORT=
OC_NATIVE_CPPFLAGS = -DNATIVE_CODE -DTARGET_$(ARCH) OC_NATIVE_CPPFLAGS = -DNATIVE_CODE -DTARGET_$(ARCH)
ifeq "$(UNIX_OR_WIN32)" "unix" ifeq "$(UNIX_OR_WIN32)" "unix"

View File

@ -74,13 +74,20 @@ CAMLdeprecated_typedef(addr, char *);
#define Noreturn #define Noreturn
#endif #endif
/* Export control (to mark primitives and to handle Windows DLL) */ /* Export control (to mark primitives and to handle Windows DLL) */
#ifndef CAMLDLLIMPORT
#if defined(SUPPORT_DYNAMIC_LINKING) && defined(ARCH_SIXTYFOUR) \
&& defined(__CYGWIN__)
#define CAMLDLLIMPORT __declspec(dllimport)
#else
#define CAMLDLLIMPORT
#endif
#endif
#define CAMLexport #define CAMLexport
#define CAMLprim #define CAMLprim
#define CAMLextern extern #define CAMLextern CAMLDLLIMPORT extern
/* Weak function definitions that can be overridden by external libs */ /* Weak function definitions that can be overridden by external libs */
/* Conservatively restricted to ELF and MacOSX platforms */ /* Conservatively restricted to ELF and MacOSX platforms */

View File

@ -18,7 +18,7 @@
#include "caml/alloc.h" #include "caml/alloc.h"
#include <stdio.h> #include <stdio.h>
extern value stub1(void); CAMLextern value stub1(void);
value stub2(void) { value stub2(void) {
printf("This is stub2, calling stub1:\n"); fflush(stdout); printf("This is stub2, calling stub1:\n"); fflush(stdout);