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

Export API Symbols for MSVC #663

Merged
merged 1 commit into from
Jul 12, 2022
Merged

Export API Symbols for MSVC #663

merged 1 commit into from
Jul 12, 2022

Conversation

TyBalduf
Copy link
Contributor

@TyBalduf TyBalduf commented Jul 8, 2022

  • By default, the Visual Studio C compiler doesn't export any symbols,
    so xtb.lib wasn't being created. Adding a def file of functions exported
    and pointing to it in meson.build allows it create xtb.lib.

This should close #646

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.

Can we generate this file in some way automatically? We already have “redundant” definitions of the C API in include/xtb.h and src/api/*.f90. Having another file which must be kept up to date makes it more error prone, especially if we are not checking the correctness in the CI.

@awvwgk awvwgk added bug Something isn't working C-API Concerns the ISO-C layer build Build system related issues (OS, compilers, meson) and removed bug Something isn't working labels Jul 11, 2022
@TyBalduf
Copy link
Contributor Author

In terms of automatic generating the def/exporting symbols, it seems like meson can't do this: mesonbuild/meson#2132

I'll work on seeing if I can get a dllexport/dllimport version working instead of making the .def file.

By default, the Visual Studio C compiler doesn't export any symbols,
so xtb.lib wasn't being created.
Explicitly export C API functions using dllexport attribute.

Signed-off-by: Ty <[email protected]>
@TyBalduf TyBalduf requested a review from awvwgk July 12, 2022 14:10
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 now.

@awvwgk awvwgk added this to the v6.6.0 milestone Jul 12, 2022
@awvwgk awvwgk merged commit 3915ff0 into grimme-lab:main Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Build system related issues (OS, compilers, meson) C-API Concerns the ISO-C layer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

xTB fails to install on Windows MingW64
2 participants