Chris00 / ocaml-cairo

Binding to Cairo, a 2D Vector Graphics Library.
GNU Lesser General Public License v3.0
54 stars 8 forks source link

Can't compile on Windows / Diskuv #33

Closed F-Loyer closed 1 year ago

F-Loyer commented 1 year ago

cairo2 doesn't compile on Windows / Diskuv / MSVC.

The preprocessor doesn't seem to support the vararg notation (args ...)

# C:\Users\frede\AppData\Local\opam\playground\.opam-switch\build\cairo2.0.6.2\_build\default\src\cairo_macros.h(178): error C2010: '.' : inattendu dans la liste de paramètres de macro
# cairo_stubs.c(1615): error C2010: '.' : inattendu dans la liste de paramètres de macro

The 178th line of cairo_macros.h is

#define RAISE_UNAVAILABLE(name, args ...)                               \

(inatendu means unexpected)

MSVC expect varargs writen as simply ... and the content is put in the __VA_ARGS__ token. See https://learn.microsoft.com/en-us/cpp/preprocessor/variadic-macros?view=msvc-170 these approch is compatible with gcc.

Chris00 commented 1 year ago

@F-Loyer May you report whether the above commit fixes it? (I do not use Windows.) Thanks.