I tried to use libdill in a C++ program that uses STL and found that it conflicts with STL.
When libdill.h is included before STL, it compiles but then link fails:
tmp/main-0f5fc5.o: In function `main':
main.cpp:(.text+0x18c3): undefined reference to `std::__1::chrono::system_clock::dill_now()'
/tmp/main-0f5fc5.o: In function `_GLOBAL__sub_I_main.cpp':
main.cpp:(.text+0x2ef3): undefined reference to `std::__1::chrono::system_clock::dill_now()'
When libdill.h is included after STL, compilation fails:
main.cpp:403:37: error: no member named 'dill_now' in 'std::__1::chrono::system_clock'
std::chrono::system_clock::now().time_since_epoch().count()
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/usr/local/include/libdill.h:95:13: note: expanded from macro 'now'
#define now dill_now
^
C can be (arguably) viewed as a subset of C++, and can normally be used from inside C++, and STL is a common C++ library.
You should probably consider using some namespace specifier, for ex. dill_, with every name it defines.
I tried to use
libdill
in a C++ program that uses STL and found that it conflicts with STL.When
libdill.h
is included before STL, it compiles but then link fails:When
libdill.h
is included after STL, compilation fails:C can be (arguably) viewed as a subset of C++, and can normally be used from inside C++, and STL is a common C++ library.
You should probably consider using some namespace specifier, for ex.
dill_
, with every name it defines.