JuliaInterop / Cxx.jl

The Julia C++ Interface
Other
757 stars 108 forks source link

Inclue Dirs #451

Open incardon opened 4 years ago

incardon commented 4 years ago

I am new to Julia (1 day) and I am looking see how to wrap the library we have (c++) in julia

Unfortunately I encountered a problem I was able to solve only in a dirty way.

I used a file that try to load the library from C++

using StaticArrays
using Cxx

#other stuffs

addHeaderDir("/home/i-bird/HDF5/include", kind=C_User)
addHeaderDir("/home/i-bird/HDF5/include",` kind=C_System)

#other stuffs

cxx""" #define DISABLE_ALL_RTTI """
cxx""" #include "Vector/vector_dist.hpp" """

addHeaderDir("/home/i-bird/HDF5/include", kind=C_User)
addHeaderDir("/home/i-bird/HDF5/include", kind=C_System)

I cutted to the essential. When I try to load it i get

In file included from /usr/local/openfpm_sparse_cl/openfpm_io/include/HDF5_wr/HDF5_writer.hpp:26:
/usr/local/openfpm_sparse_cl/openfpm_io/include/HDF5_wr/HDF5_writer_vd.hpp:64:3: error: use of undeclared identifier 'H5Pset_fapl_mpio'; did you mean 'H5Pset_fapl_core'?
                H5Pset_fapl_mpio(plist_id, comm, info);
                ^~~~~~~~~~~~~~~~
                H5Pset_fapl_core
/usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/H5FDcore.h:32:15: note: 'H5Pset_fapl_core' declared here
H5_DLL herr_t H5Pset_fapl_core(hid_t fapl_id, size_t increment,

So the problem of this error come from the fact that is taking the system wide installation of HDF5 library instead of the custom one in "/home/i-bird/HDF5/include". It seems the problem is priority of the folder because I used addHeaderDir for other headers and they work

The only dirty way to fix for now (prioritize "/home/i-bird/HDF5/include" ) I founs is going into initialization.ij and change to

const GlobalHeaders = insert!(collectAllHeaders(nostdcxx),1,("/home/i-bird/HDF5/include",Int32(1)))

Is there a better way ?