Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Marshal.Closures vs native OCaml DLL #7839
Original bug ID: 7839
I thought it should always be possible to marshal/unmarshal closures from/to the same OCaml program (with Marshal.Closures flag). Unfortunately, if OCaml system is placed into a DLL that is loaded into a main exe written in another language, this becomes problematic. Non-PIC OCaml code contains relocations that will be resolved to different addresses depending on the DLL base address (assigned by OS DLL loader). Then code fragment digests will also be different and Marshal.from_* functions will fail.
I realize this is quite rare case (most people nowadays use x64 PIC code that is not affected) but IMHO it should be at least documented (if not fixed).