Giter VIP home page Giter VIP logo

Comments (3)

pirbo avatar pirbo commented on June 12, 2024

So...
in stdlib/sys.mlp, Sys.win32 is defined as external win32 : unit -> bool = "%ostype_win32".

As far as I understand, the compiler recognize %ostype_win32 and turns it into Primitive ((Pctconst Ostype_win32), 1) (in bytecomp/translprim.ml ???? But why is it done in native compilation too then?) Anyway...

Then,

  • the bytecode compiler translates this primitive back into calling the c function caml_sys_const_ostype_win32(value unit) which is Val_bool(0 == strcmp(OCAML_OS_TYPE,"Win32")) as we want BUT
  • the native compiler optimizes this out (I'm not sure where of middle_end/simplify_primitives.ml, asmcomp/closure.ml or asmcomp/cmmgen.ml) into const_of_bool (Sys.os_type = "Win32")(or equivalent) and, as I already explained in several places including #122, because of the way cross compilation is achieve (we do basically linux-pc-ocamlrun mingw-w64-ocamlc to call the compiler), Sys.os_type "of the compiler" is the host os_type and not the target one!

Now the question becomes, why does it work in 64bits? :-D

from opam-cross-windows.

toots avatar toots commented on June 12, 2024

The plot thickens! Thanks for investigating.. Could this have to do with the fact that the 32 bit compiler is actually a 32 bit compiler inside a 64 bit host?

from opam-cross-windows.

toots avatar toots commented on June 12, 2024

I'm having the same problem with a recent build of ocaml-windows on 64 bit now.. I think I'll have to revert back to the old patches.

from opam-cross-windows.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.