{
    Header file for libuniquecheck
    Allows using the unique check library from FreePascal
    
    Library for checking unique program instances on Linux
    Copyright (C) 2024  Artyomov Alexander
    http://self-made-free.ru/
    aralni@mail.ru

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as
    published by the Free Software Foundation, either version 3 of the
    License, or (at your option) any later version.
}

unit uniquecheck;

{$MODE OBJFPC}
{$LONGSTRINGS ON}
{$PACKRECORDS C}

interface

uses ctypes;

const
  libname = 'libuniquecheck.so';

{ Initialize the library with command line arguments }
procedure uniquecheck_init(argc: cint; argv: PPChar); cdecl; external libname;

{ Check if another instance is running (system-wide) }
function uniquecheck_is_running_system: cint; cdecl; external libname;

{ Check if another instance is running (same user only) }
function uniquecheck_is_running_user: cint; cdecl; external libname;

{ Get the current program name }
function uniquecheck_get_program_name: PChar; cdecl; external libname;

{ Get the current PID }
function uniquecheck_get_pid: cint; cdecl; external libname;

implementation

end.