-
Notifications
You must be signed in to change notification settings - Fork 2.6k
C-API: Add fix for Windows and C++ #14273
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
Conversation
One or more of the following people are relevant to this code:
|
Pull Request Test Coverage Report for Build 14923581573Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding C++ compatibility is a good idea 👍🏻 I was wondering whether we shouldn't use std::complex
in C++ though, since it should be supported on all platforms?
I think |
releasenotes/notes/fix-c-api-for-windows-and-cpp-0b8d79cd3fcf975a.yaml
Outdated
Show resolved
Hide resolved
releasenotes/notes/fix-c-api-for-windows-and-cpp-0b8d79cd3fcf975a.yaml
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I verified this works with C++ out of the box. I only have one comment regarding the reno above, but then we can merge from my side 👍🏻
…75a.yaml Co-authored-by: Julien Gacon <gaconju@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the addition!
* Add fix for Windows and C++ * added ifdef for C++ * fix Makefile for Windows * fix Makefile * use std::complex for C++ * add include <complex> for C++, set OS if not Windows * directly define lib filename * Update releasenotes/notes/fix-c-api-for-windows-and-cpp-0b8d79cd3fcf975a.yaml Co-authored-by: Julien Gacon <gaconju@gmail.com> * fix code block annotation --------- Co-authored-by: Julien Gacon <gaconju@gmail.com> Co-authored-by: Julien Gacon <jules.gacon@googlemail.com>
Summary
This is fix for C-API cbindgen of
qiskit.h
Details and comments
An environment variable
OS
is defined on Windows, so I addedifdef OS
to avoid overwriting withuname
MSVC generates library whose name is not starting with
lib
, so setC_LIB_CARGO_BASENAME=qiskit_cext
for WindowsReplaced complex type definition with
std::complex
for C++Add support for C++ (
cpp_compat = true
) that defines data types to avoid C style typedef redefinition error.