Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support MSVC compiler #53

Merged
merged 1 commit into from
Mar 27, 2022
Merged

Support MSVC compiler #53

merged 1 commit into from
Mar 27, 2022

Conversation

jonahbeckford
Copy link
Contributor

  1. Define YAML_DECLARE_EXPORT so vendored yaml C code does not use the default "import" which is for when there is already a yaml DLL; without it MSVC complains that the functions are being defined even though DLL import is on. That is:
# writer.c(33): error C2491: 'yaml_emitter_flush': definition of dllimport function not allowed
# writer.c(107): warning C4244: '=': conversion from 'unsigned int' to 'unsigned char', possible loss of data
# writer.c(117): warning C4244: '=': conversion from 'unsigned int' to 'unsigned char', possible loss of data
  1. Use .lib and .obj on Windows, which fixes:
# File "types/stubgen/dune", line 11, characters 0-232:
# 11 | (rule
# 12 |  (targets ffi_ml_types_stubgen.exe)
# 13 |  (deps    (:c ./ffi_ml_types_stubgen.c) ../../vendor/libyaml_c_stubs.a)
# 14 |  (action (run %{cc} %{c} -I../../vendor %{read-lines:../../config/ctypes-cflags}
# 15 |   -I %{ocaml_where} -o %{targets})))
# Error: No rule found for vendor/libyaml_c_stubs.a

1. Define YAML_DECLARE_EXPORT so vendored yaml C code
does not use the default "import" which is for when there
is already a yaml DLL; without it MSVC complains that the
functions are being defined even though DLL import is on.

2. Use .lib and .obj on Windows
Copy link
Owner

@avsm avsm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This looks good to merge.

@samoht samoht merged commit 8db41b2 into avsm:master Mar 27, 2022
samoht added a commit to samoht/opam-repository that referenced this pull request Mar 27, 2022
CHANGES:

* Support MSVC with .obj and .lib extensions, and defining
  -DDYAML_DECLARE_EXPORT (@jonahbeckford avsm/ocaml-yaml#53)

* Upgrade to dune 2 (@TheLortex, avsm/ocaml-yaml#54)

* Add ocamlformat (@samoht, avsm/ocaml-yaml#55)

* Make yaml compatible with opam-monorepo (@TheLortex, avsm/ocaml-yaml#56)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants