There are two ways to access the C and C++ interface:
One way is to include collectorAPI.h and link with -lcollectorAPI, which contains real functions to check for the existence of the underlying libcollector.so API functions.
This way requires that you link with an API library, and works under all circumstances. If no experiment is active, the API calls are ignored.
The second way is to include libcollector.h, which contains macros that check for the existence of the underlying libcollector.so API functions.
This way works when used in the main executable, and when data collection is started at the same time the program starts. This way does not always work when dbx is used to attach to the process, nor when used from within a shared library that is dlopen’d by the process. This second way is provided for backward compatibility only, and its use is discouraged for any other purpose.
Do not link a program in any language with -lcollector. If you do, the Collector can exhibit unpredictable behavior.