Skip to content

Repository files navigation

odin-everything

Unofficial Odin bindings for Everything SDK 3.

The repository currently targets 64-bit Windows and Everything 1.5. It vendors Everything SDK 3.0.0.9 and links its static library directly into the Odin program.

Requirements

  • 64-bit Windows
  • Odin on PATH
  • Everything 1.5 running with IPC enabled for searches

Everything is not required to compile a program using the package. An IPC connection will fail at runtime when Everything is not running or its index is unavailable.

Install

Clone the repository directly, vendor it into your source tree, or add it as a Git submodule.

For an Odin project with a bindings collection:

git submodule add https://github.com/reedHam/odin-everything-sdk-bindings.git bindings/everything

Then import it with:

import everything "bindings:everything/src"

Replace bindings: with the collection name used by your project.

Example

package main

import "core:fmt"
import everything "bindings:everything/src"

main :: proc() {
	client := everything.Connect(nil)
	if client == nil {
		fmt.println("Everything is unavailable")
		return
	}
	defer everything.DestroyClient(client)

	fmt.printfln(
		"Everything %d.%d.%d.%d (target=%d)",
		everything.GetMajorVersion(client),
		everything.GetMinorVersion(client),
		everything.GetRevision(client),
		everything.GetBuildNumber(client),
		everything.GetTargetMachine(client),
	)
}

The complete runnable example is in examples/basic.

Check

.\check.ps1

The check compiles the package and the basic example with strict Odin diagnostics. Run the example separately when Everything 1.5 is available:

odin run examples/basic

Run a real IPC search against a loaded Everything index:

.\probe\run.ps1

From an x64 Visual Studio Developer PowerShell, verify the C layouts used by the generated binding:

.\abi\run.ps1

Binding structure

src/DO_NOT_EDIT_GENERATED_everything3.odin contains the complete raw API generated from Everything3.h. src/shim.odin maps Windows ABI names to core:sys/windows and supplies Unicode convenience aliases. Private C struct tags are normalized to their public typedef names, then the EVERYTHING3_ type prefix is removed. The tracked bindgen footer isolates the upstream GetTargetMachine naming defect in the generated raw surface.

The package targets Windows x64. Clang reports __stdcall functions as the C convention on x64 because Windows x64 has one platform calling convention. The corrected GetTargetMachine declaration uses Odin's system convention explicitly.

Consumers do not need odin-c-bindgen, Clang, or the Windows C toolchain. The generated Odin file and src/Everything3.lib are both checked in and can be coppied to a target project folder.

Regenerating

The tested odin-c-bindgen revision is recorded in BINDGEN_COMMIT. Place odin-c-bindgen beside this repository, put bindgen.exe on PATH, set ODIN_C_BINDGEN, or pass its path explicitly.

Verify that fresh output matches the tracked binding:

.\generate.ps1

Accept a reviewed generated change:

.\generate.ps1 -Accept

The generator writes scratch output under _generated, compares the complete procedure surface to the vendored header, and refuses to emit duplicate Windows types. Accepted output is stored in the importable src package. bindgen.sjson, the wrapper header, the footer, and the upstream header are the generation authority.

Rebuilding the static library

The checked-in src/Everything3.lib is the 64-bit static library used by the binding. The matching SDK source is retained under sdk/everything_sdk3.

From an x64 Visual Studio Developer PowerShell:

.\build_sdk.ps1

The rebuilt library is written to build/Everything3.lib.

Threading

Calls such as Search, GetResults, Sort, and WaitForResultListChange may block the calling thread. Applications with a frame or UI thread should issue blocking SDK work from a worker thread. ShutdownClient can be called from another thread to cancel pending requests.

Upstream

This project is not affiliated with or endorsed by voidtools.

License

The Odin repository code is MIT-licensed. The vendored Everything SDK is also MIT-licensed by voidtools / David Carpenter. See THIRD_PARTY_NOTICES.md and the vendored LICENSE.

About

Bindings to the everything 1.5 SDK for odin

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages