-
Notifications
You must be signed in to change notification settings - Fork 55
[Question] using C headers/libraries with rootcling/CMake interface #52
Description
We have some C shared libraries that we are wanting to package with cppyy for use in Python. We are able to use cppyy.c_include, or manually add the extern "C" code to the header files and can import that way well. However, when we use the CMake interface, things don't seem to work. After looking into the issue, it seems as if rootcling does not parse functions in C headers when an #ifdef __cplusplus extern "C" { #endif conditional block is wrapped around the header code. If we remove the conditional block from the header, the functions are mapped into the .map file and presumably into the dictionary, however the header file seems to be C++ name mangled and linking doesn't work, similar to if we tried to use a C library from cppyy with a header file without using the c_include function. Not surprising, however it makes it seem like it may not be possible to use the CMake packaging for C projects. Is there some way to tell rootcling to read the header file as a C header?
I'm not sure there is a way around the packaging side of this without wrapping everything in C++, but wanted to see if you had any ideas.
Thank you for your time and for cppyy!