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

Marshal.Closures vs native OCaml DLL #7839

Closed
vicuna opened this issue Aug 17, 2018 · 3 comments
Closed

Marshal.Closures vs native OCaml DLL #7839

vicuna opened this issue Aug 17, 2018 · 3 comments

Comments

@vicuna
Copy link

vicuna commented Aug 17, 2018

Original bug ID: 7839
Reporter: @db4
Status: new
Resolution: open
Priority: normal
Severity: minor
Platform: x86
OS: Windows
Version: 4.07.0
Category: runtime system and C interface
Monitored by: @nojb @gasche

Bug description

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).

@vicuna
Copy link
Author

vicuna commented Aug 22, 2018

Comment author: @stedolan

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.

@vicuna
Copy link
Author

vicuna commented Aug 22, 2018

Comment author: @db4

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.

@vicuna vicuna added the stdlib label Mar 14, 2019
@github-actions
Copy link

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant