Skip to content

CefVersionInfo

Header: cef_version_info.h
Interfaces: Free Functions, Structures, Helper Macros
Category: Core APIs

Overview

Foundational interfaces: process bootstrap, browser lifecycle, frames, DOM, requests, and data objects.

Free Functions

Source File: include/cef_version_info.h

Process / Thread Context: Any thread, any process; safe to call before CefInitialize.

Purpose: "Return all CEF version information for the libcef library." Populates the supplied struct (caller allocates; sets info->size first — see CEF_POPULATE_VERSION_INFO).

Structures

Source File: include/cef_version_info.h

Purpose: "Structure representing all CEF version information." Defined in two forms depending on API version: a richer version (≥ 13800) and a minimal unversioned fallback for bootstrap/library-loader use against older APIs.

Helper Macros

Source File: include/cef_version_info.h

Purpose: A macro that sets every field of a cef_version_info_t from the cef_version.h constants and invokes the two helpers above. Used by clients (and the bootstrap) to construct a version-info struct for cross-version compatibility checks against the loaded libcef.

Usage Example

cpp
(info)->size = sizeof(cef_version_info_t);
(info)->cef_version_major = CEF_VERSION_MAJOR;
(info)->cef_version_minor = CEF_VERSION_MINOR;
(info)->cef_version_patch = CEF_VERSION_PATCH;
(info)->cef_commit_number  = CEF_COMMIT_NUMBER;
(info)->chrome_version_major = CHROME_VERSION_MAJOR;
(info)->chrome_version_minor = CHROME_VERSION_MINOR;
(info)->chrome_version_build = CHROME_VERSION_BUILD;
(info)->chrome_version_patch = CHROME_VERSION_PATCH;
_CEF_POPULATE_SANDBOX_HASH(info);
_CEF_POPULATE_LIBCEF_PATH(info);
cpp
#include "include/cef_version_info.h"
#include "include/cef_version.h"

bool VerifyLoadedLibcefMatchesHeaders() {
  cef_version_info_t expected;
  CEF_POPULATE_VERSION_INFO(&expected);   // fill from compile-time #defines

  cef_version_info_t loaded{};
  loaded.size = sizeof(loaded);
  cef_version_info_all(&loaded);          // fill from loaded libcef.dll

  return expected.cef_version_major == loaded.cef_version_major &&
         expected.cef_version_minor == loaded.cef_version_minor &&
         expected.cef_version_patch == loaded.cef_version_patch &&
         expected.chrome_version_major == loaded.chrome_version_major;
}

// Or query a single component:
int cef_major = cef_version_info(0);  // CEF_VERSION_MAJOR from the loaded lib

Derived from the CEF C++ headers — © Marshall A. Greenblatt, Google Inc. & contributors (BSD-style license). Not an official CEF project.