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

Move Cstubs_internals and FOREIGN from cstubs to ctypes #537

Merged
merged 4 commits into from
Jul 14, 2017
Merged

Move Cstubs_internals and FOREIGN from cstubs to ctypes #537

merged 4 commits into from
Jul 14, 2017

Conversation

yallop
Copy link
Owner

@yallop yallop commented Jul 14, 2017

At present the interfaces used to write bindings that generate stubs (Cstubs.FOREIGN), the module that supports generated stubs (Cstubs_internals) and the functions that generate stubs (Cstubs.write_ml etc.) are all part of the same package (ctypes.stubs). Consequently, generated code depends on the ctypes.cstubs package, which sometimes causes problems (#519), since ctypes.cstubs depends on str.

This PR moves Cstubs.FOREIGN and Cstubs_internals from the ctypes.stubs package to the ctypes package, so that generated code no longer depends on ctypes.stubs. The change is backwards-compatible, so existing code should continue to work without any changes. However, if you'd like to eliminate the runtime dependency on ctypes.stubs then you can change the path of the FOREIGN interface in the Bindings functor to refer to Ctypes rather than Cstubs, as follows.

Existing way of writing bindings:

module Bindings(F: Cstubs.FOREIGN) = ...

Writing bindings without the runtime ctypes.stubs dependency:

module Bindings(F: Ctypes.FOREIGN) = ...

This PR addresses some of #528, but additional (and similar) work is still needed to move the TYPES interface from ctypes.stubs to ctypes.

@yallop yallop merged commit 75b9010 into yallop:master Jul 14, 2017
@yallop yallop deleted the cstubs-split-foreign branch July 14, 2017 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant