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

ENH: F90 bind(c) intrinsic derived types #20770

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

HaoZeke
Copy link
Member

@HaoZeke HaoZeke commented Jan 9, 2022

This PR will establish the following:

  • Intrinsic modules do not cause crackfortran failures
    • Currently only iso_c_binding generates correct wrappers
  • The mapping for ISO_C_BINDING types

Additionally, for derived types:

  • Scalar numeric types (c_float, c_double)
  • Derived types containing arrays of numeric data
  • Arrays of derived types

These are being ported over from https://github.com/HaoZeke/f2py_skel/pull/17/files.

The F90 derived type support is in line with #14938.

The implementation is fairly modular, and modifies the global dictionary to generate bind(c) compatible code.

A tracking issue should cover the rest of the items (strings, pointers) which are needed to fully support the standard interoperable C structures.

Requires #15844.

@HaoZeke HaoZeke marked this pull request as draft January 9, 2022 05:16
@HaoZeke HaoZeke changed the title DRAFT: F90 bind(c) intrinsic derived types ENH: F90 bind(c) intrinsic derived types Jan 9, 2022
@HaoZeke
Copy link
Member Author

HaoZeke commented Mar 6, 2022

I'm thinking of splitting this up. It is already rather a lot to review. The remaining bullet points have been shifted into #21160.

It would be good to have this in before finalizing the 3-part NEP on F2PY.

@melissawm and @pearu if the implementation and existing tests seem good, then perhaps we can iterate on this in successive PRs?

@HaoZeke
Copy link
Member Author

HaoZeke commented Oct 24, 2023

I understand that without the array support this is more skeletal than it ought to be, but it might still cover enough ground to be useful. If I can't find more time to add the array support (haven't looked it over in a while) it might be useful to just merge it (after rebases of course).

@HaoZeke
Copy link
Member Author

HaoZeke commented Nov 5, 2023

A better / alternate implementation is now almost ready here: https://github.com/HaoZeke/f2py_derived_nep/pull/5/files

One thing to note is that using the PyCapslue method for types which are beyond iso_c seem to require a copy of the input values (so far at any rate).

Needs support from the parser too.

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

Successfully merging this pull request may close these issues.

None yet

3 participants