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

Wish: FFI API for the Unix module #4589

Closed
vicuna opened this issue Jul 23, 2008 · 2 comments
Closed

Wish: FFI API for the Unix module #4589

vicuna opened this issue Jul 23, 2008 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Jul 23, 2008

Original bug ID: 4589
Reporter: gerd
Status: acknowledged (set by @damiendoligez on 2008-09-23T17:48:15Z)
Resolution: open
Priority: normal
Severity: feature
Version: 3.10.2
Category: otherlibs
Monitored by: @alainfrisch

Bug description

I'm often writing extensions to the Unix module using the FFI. Currently, this is a bit awkward, because there is no API, and one has to rely on undocumented features. What would be helpful (at minimum):

  • C functions for accessing and creating file descriptors
  • C functions for accessing and creating inet_addr
  • C function to turn an OS error into a Unix.error

This API would hide the differences between Unix and Win32.

For Win32 there is additionally a linking problem. Currently, functions like uerror cannot be called from a custom DLL because these functions aren't exported. Furthermore, there is no import lib for dllunix.dll.

Additional information

For ocamlnet I'm currently working around by

  • calling undocumented functions like uerror
  • for Win32, by even including a copy of unixsupport.c

See here for code: https://godirepo.camlcity.org/svn/lib-ocamlnet2/trunk/code/src/netsys/

@vicuna
Copy link
Author

vicuna commented Jul 23, 2008

Comment author: @alainfrisch

Note that on the current CVS trunk, the semantics of dynamic libraries is similar to the Unix one on Win32: you are able to access symbols defined in dllunix.dll even though there is no import library and symbols are not exported explicitly.

@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