Truxton C API

From truxwiki.com
Revision as of 04:15, 2 December 2020 by Sam (talk | contribs) (→‎File Export)
Jump to navigation Jump to search

Truxton functionality is exposed to the C programming world as a DLL named TruxtonCAPI.dll in the C:\Program Files\Truxton\SDK folder. This DLL can be called from any programming language that has the ability to make operating system calls.

Philosophy

The API is considered to be "flat" in that only sixty-four bit integers and ASCII character strings are used in the interface. This was chosen to make it easy for other languages to call the API. The coding convention is all lower case names with underscores separating words. Truxton is a member of the east const posse.

Creating a lib

Truxton doesn't ship a linker library for TruxtonCAPI.dll in order not to tie the developer to any particular compiler. If you want to link TruxtonCAPI.dll with your own C/C++ code, you will need to generate a linker library.

Generating a Linker Library for Microsoft Compilers

You can download a free Visual Studio from Microsoft. The steps to produce a LIB file from a DLL are:

  1. Generate a module definition (DEF) file from TruxtonCAPI.dll.
  2. Use the DEF file to create the linker library (LIB) file.

Generate a Module Definition File

The following Powershell script will create the DEF file.

$dumpbin = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\Hostx64\x64\dumpbin.exe"

$lines = (& $dumpbin /exports TruxtonCAPI.dll)

Write-Output "EXPORTS"

foreach ( $line in $lines )
{
   if ( $line.Contains(" = ") -EQ $true )
   {
      Write-Output $line.SubString($line.IndexOf(" = ") + 3)
   }
}

In your SDK folder, execute the script from Powershell:

MakeDef.ps1 >TruxtonCAPI.def

Generate a LIB File

Now that you have the DEF file, you can create the linker library using lib.exe (which is found in the same folder as dumpbin.exe) in the command window:

lib.exe /def:TruxtonCAPI.def /out:TruxtonCAPI.lib /machine:x64

API Groups

The API is broken down into the different areas of Truxton.

Initialization

Functions

ETL Functions

Child Files

A child file is one that you have created and need to save in Truxton.

Creating things related to this file:

File IO

File Record Fields

File Actions

These are things your can do to a file. These are not data items stored in the database.

Create Objects from File

The following APIs are used to create objects with a file as their parent.

Debugging

Media

These are the API's that allow you to add to the Media table in the database.

Message

This is the message sent on the message bus between the ETL processes.

File Export

Artifacts

Artifacts are pieces of information that are also known as entities.

Event

If you need to save a significant place in time, use the following functions. These will create a record in the [Event] table.

EXIF (Camera Information)

File Type

Geographic Location

Options

Truxton "options" are otherwise known as configuration settings, command line options, etc. They are configuration items that your program can use.

Relation

Website Visit

USB Device