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
Demonstrate a mixed C and C++ library #870
Comments
@big-guy That's the case for the Poco library. At least 2 modules (XMLand PDF) are made of both C and C++ code source in the same src directory. There are as well in the same directory many include files. |
This would include mixed mode for all the supported languages, right? I have a C++ and Objective C++ mixed mode library in one of my projects that would need this as well. |
Yes, whatever solution comes out of this will most likely be the solution for any other mixed language. |
Are there any plans to support this in the foreseeable future? I am currently evaluating the use of native gradle for a bigger project and this is a real drawback. |
We hope to take action on this soon. That doesn't mean it's not possible at the moment. It's all possible but requires more configuration than expected. There is two use case when it comes to mixing C and C++: 1) C and C++ projects are separated (C code compiled & linked with only C code and C++ code compiled & linked with only C++ code) and 2) C and C++ code is compiled and linked together. Which use case are you facing the most? |
I found the workarounds for 1) and they work as described. I am looking for a way to compile and link C and C++ code together (2). I have also not found a solution to how I could pass different compiler args depending on the sources, as I could find no concept of different sourceset as it was the case with the old model. To be fair most of the time we are facing 1) with some old code also requiring 2) . |
For compiling and linking C and C++ code together, you will need to create
As for different compiler args depending on the sources, could you expand on your use case? Most of the time we heard this use case was to change the optimization and debugging of some files during development. For that specific use case, we would provide a better solution than simply allowing users to configure whatever flag for each file. If you have another use case, we would be pleased to add it to our list. |
Thanks a lot for the example. I will try that soon. The use case I needed is simple, as all I wanted was to instruct the clang C++ compiler to treat C files as C code with '-x c'. |
Then using |
We have a sample for building C and several samples where we build C++.
If someone had a single library that used both, how would we do it in the current plugins?
The text was updated successfully, but these errors were encountered: