This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Best (proper) way to integrate a third party library written in C++

+1 vote

What is the best way to make use of a third party library written in C++? We'd like to access a library that we've written from a python-based fenics application.

I've seen the example in the documentation where custom C++ code is made accessible (probe.cpp) and was wondering if this is suggested route. Shall we just make a single source file shim code, access our library through this and then pass the needed flags to compile by passing them to swigargs? Or is there a better way to do this?

Thanks!

Chris

asked Feb 8, 2016 by chris FEniCS Novice (130 points)

1 Answer

0 votes

This is probably the best way. If you look into dolfin, you will see a separate directory called swig where all the SWIG stuff is happening. SWIG can parse C++ code quite will but will often need some directions and this is described in the .i files. If you have a library you want to expose to Python you probably should organize it similarly. If the library is small you may be happy with instant.

answered Feb 9, 2016 by Kent-Andre Mardal FEniCS Expert (14,380 points)
...