Skip to content

CefApiHash

Header: cef_api_hash.h
Category: Core APIs

Overview

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

Free Functions

Source File: include/cef_api_hash.h

Process / Thread Context: Any thread, any process.

Purpose: "Returns the CEF API version that was configured by the first call to cef_api_hash()."

Usage Example

cpp
#include "include/cef_api_hash.h"
#include "include/cef_version.h"
#include <cstdio>

bool VerifyApiCompat() {
  // Force-configures the loaded library's API version to match the
  // compiled-in CEF_API_VERSION (first call wins). Then read back the
  // platform API hash and the resolved version.
  const char* hash = cef_api_hash(CEF_API_VERSION, /* entry */ 0);
  int loaded_version = cef_api_version();

  std::printf("CEF API hash: %s\n", hash);
  std::printf("CEF API version: %d\n", loaded_version);

  // Optional: compare hash to the compile-time constant
  // CEF_API_HASH_PLATFORM (defined in cef_api_versions.h via cef_api_hash.h).
  return loaded_version >= CEF_API_VERSION_MIN &&
         loaded_version <= CEF_API_VERSION_LAST;
}

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