# Class: com.pnfsoftware.jeb.core.units.code.asm.type.TypeLibraryService

The type library service \(TLS\) is responsible for managing \(loading and unloading\) native code type libraries \(`typelibs`\). There is one TLS per JEB engines context. It can be retrieved via [IEnginesContext#getTypeLibraryService()](IEnginesContext#getTypeLibraryService()). 

 This class is thread\-safe. 

 Positive UUIDs \(range \[0, 0x80000000\[\) is reserved for internal use. External users may use negative UUIDs.

## Constructor: TypeLibraryService

Description: Create a new TLS. At least one folder must be added using [#addFolder(File, boolean)](#addFolder(File, boolean)).

## Constructor: TypeLibraryService
- parameter: `folder`, type: `java.io.File`

Description: Create a new TLS with an initial folder. The folder will be scanned.
parameter: folder: initial type library folder

## Static Field: GROUPID_TYPELIB_EFI
Type: `int`

Constant value: `30`
Description: EFI type library group.

## Static Field: GROUPID_TYPELIB_LINUX
Type: `int`

Constant value: `2`
Description: Linux type library group.

## Static Field: GROUPID_TYPELIB_LINUX_ANDROID
Type: `int`

Constant value: `3`
Description: Android/Linux type library group.

## Static Field: GROUPID_TYPELIB_POSIX
Type: `int`

Constant value: `1`
Description: POSIX type library group.

## Static Field: GROUPID_TYPELIB_TEST
Type: `int`

Constant value: `100`
Description: reserved for internal use

## Static Field: GROUPID_TYPELIB_TEST1
Type: `int`

Constant value: `101`
Description: reserved for internal use

## Static Field: GROUPID_TYPELIB_TEST2
Type: `int`

Constant value: `102`
Description: reserved for internal use

## Static Field: GROUPID_TYPELIB_TEST3
Type: `int`

Constant value: `103`
Description: reserved for internal use

## Static Field: GROUPID_TYPELIB_TEST4
Type: `int`

Constant value: `104`
Description: reserved for internal use

## Static Field: GROUPID_TYPELIB_UNKNOWN
Type: `int`

Constant value: `0`
Description: Unknown or unspecified type library group.

## Static Field: GROUPID_TYPELIB_WIN32
Type: `int`

Constant value: `10`
Description: Win32 type library group.

## Static Field: GROUPID_TYPELIB_WINDDK
Type: `int`

Constant value: `20`
Description: Windows DDK type library group.

## Static Field: GROUPID_TYPELIB_WINDOWS
Type: `int`

Constant value: `9`
Description: Windows type library group.

## Static Field: TYPELIB_FILE_EXTENSION
Type: `java.lang.String`

Constant value: `.typelib`
Description: Extension used by binary type library files.

## Method: addFolder
- parameter: `folder`, type: `java.io.File`
- parameter: `doRescan`, type: `boolean`

Description: Add a typelib folder to this TLS.
parameter: folder: type library folder
parameter: doRescan: if true, [#rescan()](#rescan()) will be invoked after the folder addition

## Method: findConstantsByName
- parameter: `name`, type: `java.lang.String`
- parameter: `procType`, type: `com.pnfsoftware.jeb.core.units.codeobject.ProcessorType`
- parameter: `groupId`, type: `int`
- return type: `java.util.Set<java.lang.Object>`

Description: Find constants by name in the currently loaded typelibs. Convenience routine.
parameter: name: constant name
parameter: procType: optional
parameter: groupId: optional \(0 if none/unknown\)
return: matching constant values

## Method: findFirstIntegerConstantByName
- parameter: `name`, type: `java.lang.String`
- return type: `java.lang.Long`

Description: Find the first integer constant by name in the currently loaded typelibs. Convenience routine.
parameter: name: constant name
return: a constant, null if none

## Method: findRoutineByName
- parameter: `name`, type: `java.lang.String`
- parameter: `procType`, type: `com.pnfsoftware.jeb.core.units.codeobject.ProcessorType`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.items.INativeMethodItem`

Description: Convenience method.
parameter: name: routine name
parameter: procType: optional
return: matching routine, or null if none was found

## Method: findRoutineByName
- parameter: `name`, type: `java.lang.String`
- parameter: `procType`, type: `com.pnfsoftware.jeb.core.units.codeobject.ProcessorType`
- parameter: `groupId`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.items.INativeMethodItem`

Description: Find a routine by simple name in the currently loaded typelibs. Convenience routine.
parameter: name: routine name
parameter: procType: optional
parameter: groupId: optional \(0 if none/unknown\)
return: matching routine, or null if none was found

## Method: findTypeBySignature
- parameter: `signature`, type: `java.lang.String`
- parameter: `procType`, type: `com.pnfsoftware.jeb.core.units.codeobject.ProcessorType`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.type.INativeType`

Description: Find a type by signature in the currently loaded typelibs. Convenience routine.
parameter: signature: type signature
parameter: procType: optional
return: matching type, or null if none was found

## Method: findTypeBySignature
- parameter: `signature`, type: `java.lang.String`
- parameter: `procType`, type: `com.pnfsoftware.jeb.core.units.codeobject.ProcessorType`
- parameter: `groupId`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.type.INativeType`

Description: Find a type by signature in the currently loaded typelibs. Convenience routine.
parameter: signature: type signature
parameter: procType: optional
parameter: groupId: optional \(0 if none/unknown\)
return: matching type, or null if none was found

## Method: getAvailables
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.type.TypeLibraryEntry>`

Description: Get the list of available type library entries. An available typelib is not necessarily loaded. Refer to [TypeLibraryEntry](TypeLibraryEntry) for additional details about the state of a given typelib.
return: available type library entries

## Method: getLoadedTypeLibraries
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.type.ITypeLibrary>`

Description: Get the list of loaded type libraries. More type libraries may be available, eg non\-loaded ones.
return: loaded type libraries

## Method: getLoadedTypeLibraryEntries
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.type.TypeLibraryEntry>`

Description: Get the list of entries that specify a loaded typelib.
return: loaded type library entries

## Method: getNotLoadedTypeLibraryEntries
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.type.TypeLibraryEntry>`

Description: Get the list of entries that specify an unloaded typelib.
return: unloaded type library entries

## Method: load
- parameter: `entry`, type: `com.pnfsoftware.jeb.core.units.code.asm.type.TypeLibraryEntry`
- return type: `boolean`

Description: Load the provided type library into this TLS.
parameter: entry: type library entry to load
return: true if the entry is loaded after this call

## Method: load
- parameter: `processorType`, type: `com.pnfsoftware.jeb.core.units.codeobject.ProcessorType`
- parameter: `groupId`, type: `int`
- return type: `boolean`

Description: Load all type libraries matching the given processor and group.
parameter: processorType: processor type to match
parameter: groupId: type library group identifier to match
return: success indicator if one or more typelib was loaded

## Method: load
- parameter: `processorType`, type: `com.pnfsoftware.jeb.core.units.codeobject.ProcessorType`
- parameter: `groupId`, type: `int`
- parameter: `maxCount`, type: `int`
- return type: `boolean`

Description: Load type libraries matching the given processor and group.
parameter: processorType: mandatory
parameter: groupId: mandatory
parameter: maxCount: maximum number of matching type libraries to load
return: success indicator if one or more typelib was loaded

## Method: loadExternal
- parameter: `typelib`, type: `com.pnfsoftware.jeb.core.units.code.asm.type.ITypeLibrary`
- return type: `boolean`

Description: Load the provided external \(not backed by a file managed by this TLS\) typelib object.
parameter: typelib: external type library object
return: true if the external type library was registered

## Method: loadSingle
- parameter: `processorType`, type: `com.pnfsoftware.jeb.core.units.codeobject.ProcessorType`
- parameter: `groupId`, type: `int`
- return type: `boolean`

Description: Load the highest priority type library matching the given processor type and group.
parameter: processorType: processor type to match
parameter: groupId: type library group identifier to match
return: success indicator

## Method: rescan

Description: Rescan the registered type library folders and delete obsolete entries.

## Method: rescan
- parameter: `deleteOldEntries`, type: `boolean`

Description: Rescan the type library folders to register/unregister additional/removed typelib binary files.
parameter: deleteOldEntries: true to delete stale or superseded type library files

## Method: unload
- parameter: `typelib`, type: `com.pnfsoftware.jeb.core.units.code.asm.type.ITypeLibrary`
- return type: `boolean`

Description: Unload a type library.
parameter: typelib: a type library
return: true if the typelib was previously loaded and is now unloaded; false otherwise

## Method: unload
- parameter: `e`, type: `com.pnfsoftware.jeb.core.units.code.asm.type.TypeLibraryEntry`
- return type: `boolean`

Description: Unload a type library.
parameter: e: a typelib entry
return: true if the typelib was previously loaded and is now unloaded; false otherwise

## Method: unloadAll
- return type: `int`

Description: Unload all type libraries.
return: the number of typelibs that were unloaded

## Static Method: groupIdToName
- parameter: `id`, type: `int`
- return type: `java.lang.String`

Description: Get a display name for a type library group identifier.
parameter: id: type library group identifier
return: the display name, or the decimal identifier if the group is unknown

