---
product: Chilkat
product_version: 11.7.0
language: c
language_label: C
document: language guide
---
> Chilkat 11.7.0 · language=c · this file: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/c/guide.md`
> Class pages: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/c/classes/<Class>.md`

# Chilkat for C — language guide — v11.7.0

## 1. Which Chilkat binding this is

This is the **Chilkat C API**: handle types `HCkHttp`, `HCkZip`, …, functions `CkHttp_Create()`, `CkHttp_Dispose(h)`, `CkHttp_QuickGetStr(h, url, outStr)`, lowercase-initial string functions `CkHttp_quickGetStr(h, url)`, property functions `CkHttp_putPort(h, 443)` / `CkHttp_getPort(h)`. It ships in the same download as the C++ library (`downloads_cpp.asp`) and can be used from any language that calls C. A Unicode variant (`CkHttpW_*`, `wchar_t`) has its own reference under `wc/`.

## 2. Install and requirements

Download the library for your compiler and platform from [https://www.chilkatsoft.com/downloads_cpp.asp](https://www.chilkatsoft.com/downloads_cpp.asp) (the C and C++ APIs are in the same package), include `C_CkHttp.h` etc., and link the static library plus the platform libraries listed on the page.

## 3. Unlocking, object creation, lifetime and errors

Generated from the reference documentation for this binding:

**Create/Dispose**

```c
HCkGlobal instance = CkGlobal_Create();
// ...
CkGlobal_Dispose(instance);
```

`HCkGlobal CkGlobal_Create(void);`

Creates an instance of the HCkGlobal object and returns a handle ("void \*" pointer). The handle is passed in the 1st argument for the functions listed on this page.

`void CkGlobal_Dispose(HCkGlobal handle);`

Objects created by calling CkGlobal_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function. Also, any handle returned by a Chilkat "C" function must also be freed by the application by calling the appropriate Dispose method, such as CkGlobal_Dispose.

## 4. Error model

Functions **never raise anything**. The note under each function on the class page says how it reports failure: a `BOOL` status function returns `FALSE`; the lowercase-initial string form returns `NULL` on failure (and the returned `const char *` is owned by the object, valid until the next call on that handle); the uppercase form fills an `HCkString` and returns `BOOL`; object-returning functions return `0`, and the returned handle must be disposed by the caller; for an `int` result check `CkHttp_getLastMethodSuccess(h)`. `CkHttp_lastErrorText(h)` holds the diagnostic in every case.

Literals in C: true is `TRUE`, false is `FALSE`, null/none is `NULL`.

## 5. Strings, bytes and encodings

- Strings are `const char *` in UTF-8 when `CkHttp_putUtf8(h, TRUE)` (default in v11); a `charset` argument names the encoding of the *bytes* being produced or read.
- Binary data goes through `HCkByteData` (`CkByteData_getData`, `CkByteData_getSize`, `CkByteData_append`) and `HCkBinData` (`Bd` functions); text through `HCkString` / `HCkStringBuilder`.
- Functions with `2`/`3` suffixes or `Quick*` prefixes are distinct functions, not overloads.

## 6. Object lifetime and threading

Every handle created with `Ck*_Create()` or returned by a function must be released with the matching `Ck*_Dispose(h)`.

A Chilkat object may be used from any thread, but **one object must not be used by two threads at the same time**: create one object per thread or protect it with a lock. Objects are independent — there is no shared global state other than the unlock flag and the few `Global` settings.

## 7. Progress callbacks and async

This binding delivers progress through **callback function pointers** (AbortCheck, PercentDone, ProgressInfo, TaskCompleted) set with `CkHttp_setAbortCheck(h, fn)` etc. — see [https://www.chilkatsoft.com/c_event_callbacks.asp](https://www.chilkatsoft.com/c_event_callbacks.asp) and the "Events and callbacks" section of a class page. `*Async` functions return an `HCkTask`; poll `CkTask_getFinished` and read the result from the task.

## 8. Common mistakes an AI makes with this binding

1. Forgetting `Ck*_Dispose` on created or returned handles.
2. Keeping a `const char *` returned by a lowercase function across another call on the same handle.
3. Calling C++ class syntax (`http.QuickGetStr(...)`) — this binding is functions over handles.
4. Omitting `Global.UnlockBundle` (the program runs in trial mode and stops working after 30 days).
5. Inventing members by analogy with other libraries. If a member is not on the class page, it does not exist — look it up rather than guessing.
6. Using deprecated members that older examples still show. The class page lists each one with its replacement; `deprecated.md` lists them all.
7. Ignoring the failure path. Every Chilkat method reports failure (see each method's note); `LastErrorText` says why, and printing it is the first debugging step.
8. Using one Chilkat object from two threads at the same time. Create one object per thread, or protect it with a lock.

## 9. Instructions block for coding agents

Paste into `CLAUDE.md`, `.cursor/rules`, or Copilot instructions:

```
This project uses Chilkat 11.7.0 from C (the C API: HCkHttp handles and CkHttp_* functions from the Chilkat C/C++ download).
- Reference: https://www.chilkatsoft.com/ai-docs/v/11.7.0/c/ — read guide.md once, then classes/<Class>.md for each class used.
- Create an HCkGlobal with CkGlobal_Create() and call CkGlobal_UnlockBundle(h, ...) once at startup; dispose every handle with Ck*_Dispose.
- Functions never raise: lowercase string functions return NULL on failure, BOOL status functions return FALSE; print CkXxx_lastErrorText(h) on failure.
- Never use a member that is not on the class page; never use members listed as deprecated.
```

## 10. Classes

[Class index for C](https://www.chilkatsoft.com/ai-docs/v/11.7.0/c/index.md)
