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

Make c-api example MSVC compatible #648

Merged
merged 2 commits into from
Jun 27, 2022
Merged

Make c-api example MSVC compatible #648

merged 2 commits into from
Jun 27, 2022

Conversation

TyBalduf
Copy link
Contributor

MSVC cl has stricter rules about constants than other compilers
(e.g variables declared const are not constant at compile time and so
aren't consider constant). This means the compiler won't allow const
variables to be used to declare array sizes.

The changes here explicitly allocate/free memory for arrays so that
the MSVC cl compiler can run this example. The c-api itself should work
without these changes, but the example was incompatible and was halting
compilation.

MSVC cl has stricter rules about constants than other compilers
(e.g variables declared `const` are not constant at compile time and so
aren't consider constant). This means the compiler won't allow `const`
variables to be used to declare array sizes.

The changes here explicitly allocate/free memory for arrays so that
the MSVC cl compiler can run this example. The c-api itself should work
without these changes, but the example was incompatible and was halting
compilation.

Signed-off-by: Ty <ty.balduf@schrodinger.com>
Signed-off-by: Ty <ty.balduf@schrodinger.com>
@awvwgk awvwgk added the C-API Concerns the ISO-C layer label Jun 27, 2022
Copy link
Member

@awvwgk awvwgk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for sharing. Looks good to me.

@awvwgk awvwgk merged commit 0e72e9d into grimme-lab:main Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-API Concerns the ISO-C layer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make c_api_example compatible with MSVC clang compiler
2 participants