Search code examples
cboost-date-time

Boost.DateTime from C?


Is it possible to use the Boost.DateTime library from C, and if so are there any examples available (preferably covering the build process using gcc-type tools)? I've searched the Boost documentation and the internet in general, and it seems theoretically possible, but have not found any clear answer one way or the other.


Solution

  • No. Boost is a C++ library and Boost.DateTime is no exception. If you look at any of the DateTime headers you'll see C++ features everywhere, from classes to templates to namespaces and much more - none of which are supported in C.

    You can, however, create a wrapper library in C++ which exposes the functionality you need as pure C functions, then call those from C.