Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007839OCamlruntime system and C interfacepublic2018-08-17 16:002018-08-22 16:08
Assigned To 
Platformx86OSWindowsOS Version
Product Version4.07.0 
Target VersionFixed in Version 
Summary0007839: Marshal.Closures vs native OCaml DLL
DescriptionI 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).
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
stedolan (developer)
2018-08-22 15:54

Are you describing a situation where code written in OCaml is compiled as non-PIC, but the runtime system is placed in a DLL? If so, I'm surprised that's even possible.
db (reporter)
2018-08-22 16:08

Why not? Under Windows (my case) you don't have PIC at all, under Linux/x86 PIC is not required for DLLs, just recommended. Only Linux/x64 prohibits to link non-PIC code into a DLL.

- Issue History
Date Modified Username Field Change
2018-08-17 16:00 db New Issue
2018-08-22 15:54 stedolan Note Added: 0019308
2018-08-22 16:08 db Note Added: 0019309

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker