(* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 3.0.11
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- *)

unit example;


{$define example_FUNCTION_WRAPPER}


{$define example_CLASS_WRAPPER}

interface

uses 
     Classes,
     SysUtils;


//type PDouble = ^double;


	type  
		Pdouble=^double;
		doubleArray = array[0..(MaxInt div sizeof(double))-1] of double;
		PdoubleArray = ^doubleArray;



	type  
		Pcardinal=^cardinal;
		cardinalArray = array[0..(MaxInt div sizeof(cardinal))-1] of cardinal;
		PcardinalArray = ^cardinalArray;



	type  
		CFILE=type Pointer;
		CFILEArray = array[0..(MaxInt div sizeof(CFILE))-1] of CFILE;
		PCFILEArray = ^CFILEArray;


type

vecint = type pointer;
PvecintArray = ^vecintArray_;
vecintArray_=array[0..(MaxInt div sizeof(vecint))-1] of vecint;

type
	Psize_t = ^Cardinal;


function maxint (a, b: Integer): Integer; stdcall;

function maxdouble (a, b: Double): Double; stdcall;

function New_vecint (_sz: Integer): vecint; stdcall;

function Vecint_get ( self: vecint;
index: Integer): PInteger; stdcall;

procedure Vecint__set ( self: vecint;
index: Integer;
 val: Integer); stdcall;

function Vecint_getitem ( self: vecint;
index: Integer): Integer; stdcall;

procedure Vecint_setitem ( self: vecint;
index, val: Integer); stdcall;

procedure Delete_vecint ( self: vecint); stdcall;

{$ifdef example_CLASS_WRAPPER}

type

  Tvecint = class (TObject, IUnknown)

  private
    FCObjPtr : vecint;
    FOwnCObjPtr : boolean;

  protected
	procedure SetCObjPtr(Value : vecint);
  // IUnknown
    function _AddRef : integer; stdcall;
    function _Release: integer; stdcall;
    function QueryInterface(const GUID:TGUID; out Intf): HRESULT; stdcall;
 public

    constructor Create; overload; virtual;
    constructor Create(CObj:vecint; OwnObj:boolean); overload; 

    constructor Create ( _sz: Integer);overload; 

    function get ( index: Integer): PInteger;

    procedure _set ( index: Integer; var val: Integer);

    function getitem ( index: Integer): Integer;

    procedure setitem ( index: Integer;  val: Integer);

    destructor Destroy; override;
  
  public  
    property CObjPtr : vecint read FCObjPtr write SetCObjPtr;
    property OwnCObjPtr : boolean read FOwnCObjPtr  write FOwnCObjPtr ;

  end;


{$endif} //example_CLASS_WRAPPER

{$ifdef example_FUNCTION_WRAPPER}

// Functions Wrapper 


{$endif} //example_FUNCTION_WRAPPER

implementation


const __DLLNAME= 'example.dll';


const __WRAPDLLNAME= 'example.dll';


function maxint (a, b: Integer): Integer; stdcall; external __DLLNAME name 'Delphi_maxint';

function maxdouble (a, b: Double): Double; stdcall; external __DLLNAME name 'Delphi_maxdouble';

function New_vecint (_sz: Integer): vecint; stdcall; external __DLLNAME name 'Delphi_new_vecint';

function Vecint_get ( self: vecint;
index: Integer): PInteger; stdcall; external __DLLNAME name 'Delphi_vecint_get';

procedure Vecint__set ( self: vecint;
index: Integer;
 val: Integer); stdcall; external __DLLNAME name 'Delphi_vecint__set';

function Vecint_getitem ( self: vecint;
index: Integer): Integer; stdcall; external __DLLNAME name 'Delphi_vecint_getitem';

procedure Vecint_setitem ( self: vecint;
index, val: Integer); stdcall; external __DLLNAME name 'Delphi_vecint_setitem';

procedure Delete_vecint ( self: vecint); stdcall; external __DLLNAME name 'Delphi_delete_vecint';

{$ifdef example_FUNCTION_WRAPPER}

// Functions Wrapper 


{$endif} //example_FUNCTION_WRAPPER

{$ifdef example_CLASS_WRAPPER}

constructor Tvecint.Create ( _sz: Integer);

begin

  inherited Create;
  FOwnCObjPtr := true;
   FCObjPtr := example.New_vecint(_sz);

end;

function Tvecint.get ( index: Integer): PInteger;

begin

  assert(FCObjPtr <> nil);
  Result := example.Vecint_get(Self.FCObjPtr, index) ;

end;

procedure Tvecint._set ( index: Integer; var val: Integer);


begin

  assert(FCObjPtr <> nil);

 example.Vecint__set(Self.FCObjPtr, index, val);


end;

function Tvecint.getitem ( index: Integer): Integer;

begin

  assert(FCObjPtr <> nil);
  Result := example.Vecint_getitem(Self.FCObjPtr, index) ;

end;

procedure Tvecint.setitem ( index: Integer;  val: Integer);

begin

  assert(FCObjPtr <> nil);
 example.Vecint_setitem(Self.FCObjPtr, index, val);

end;


function Tvecint._AddRef : integer;
begin
   Result := -1;
end;

function Tvecint._Release: integer;
begin
   Result := -1;
end;

function Tvecint.QueryInterface(const GUID:TGUID; out Intf): HRESULT;
begin
   if GetInterface(GUID, Intf) then
      Result := S_OK
   else
      Result := S_FALSE	;
end; 
 
constructor Tvecint.Create; 
begin
  inherited Create;
  FCObjPtr := nil;
  FOwnCObjPtr := true
end;

constructor Tvecint.Create(CObj:vecint; OwnObj:boolean); 
begin
  inherited Create;
  FCObjPtr := CObj;
  FOwnCObjPtr := OwnObj
end;


destructor Tvecint.Destroy; 
begin   
  if (FCObjPtr <> nil) and  FOwnCObjPtr then begin 
    example.delete_vecint(FCObjPtr);
    FOwnCObjPtr := false;
  end;
  FCObjPtr := nil; 
  inherited Destroy;
end;

procedure Tvecint.SetCObjPtr(Value : vecint);
begin
 
  if (Value <> FCObjPtr) then begin
	if (FCObjPtr <> nil) and  FOwnCObjPtr then begin 
		example.delete_vecint(FCObjPtr);
	end;
	FCObjPtr := Value;
  
  
  end;

end;


{$endif} //example_CLASS_WRAPPER

initialization



// constant initialization



//initialization


finalization


//finalization


end.
