C API

See also:
- C API Changes for Release 9.0
- Python API

If you are using the API, please contact ddcutil's author (rockowitz@minsoft.com>), both because your input on the API would be helpful and also so I can alert you of upcoming changes.

Naming

Symbol names begin with "ddca_" or "DDCA_" (for DDCutil Api).

Installation

Header files are located in the src/public directory. They are normally installed to /usr/include or /usr/local/include.

Header File Name Contains
ddcutil_types.h typedefs, structs, enums, etc.
ddcutil_c_api.h API functions
ddcutil_status_codes.h ddcutil specific status codes
ddcutil_macros.h macros to specify ddcutil version at compile time

The API is exposed using shared library libddcutil.so. The API is subject to change, and will not be SONAME versioned until release 1.0. Note that the command line version of ddcutil does not itself use the shared library, but instead links all services statically.

Installation (make install, package install) installs a Package Config file (ddcutil.pc).

Installation also saves a cmake file (FindDDCUtil.cmake) in directory /usr/share/ddcutil/data (or /usr/local/share/ddcutil/data if appropriate). To use this file, copy it to /usr/share/cmake/Modules.

configure options relating to the C API:

Option Function
--enable-lib Build shared library. Required for the C API

Documentation

C API documentation:
- The header files contain extensive documentation.
- Doxygen documentation can be generated (if Doxygen is installed) using scripts in the doxydoc directory. However, I think you'll find the comments in the header files and sample code easier to use.

Sample programs are found in directory src/sample_programs:

Source file Contents
demo_capabilities.c Query monitor capabilities string
demo_display_selection.c Select display
demo_feature_list.c Using DDCA_Feature_List
demo_get_set_vcp.c Read and write VCP feature values
demo_global_settings.c Query and change global settings
demo_profile_features.c Save and restore color profile related features
demo_redirection.c Capture program output
demo_vcpinfo.c Query VCP feature metadata

To build the sample client programs, issue the command make check.