---
title: "LibraryFunction"
language: "en"
type: "Symbol"
summary: "LibraryFunction[args] represents a function that has been loaded from a Wolfram Library."
keywords: 
- add external function
- extend functions
- load external library
- MathLink
- dynamic library
- shared library
- DLL
canonical_url: "https://reference.wolfram.com/language/ref/LibraryFunction.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Wolfram LibraryLink"
    link: "https://reference.wolfram.com/language/guide/LibraryLink.en.md"
  - 
    title: "C/C++ Language Interface"
    link: "https://reference.wolfram.com/language/guide/CLanguageInterface.en.md"
  - 
    title: "Calling External Programs"
    link: "https://reference.wolfram.com/language/guide/CallingExternalPrograms.en.md"
  - 
    title: "External Language Interfaces"
    link: "https://reference.wolfram.com/language/guide/ExternalLanguageInterfaces.en.md"
  - 
    title: "External Operations"
    link: "https://reference.wolfram.com/language/guide/ExternalOperations.en.md"
related_functions: 
  - 
    title: "LibraryFunctionLoad"
    link: "https://reference.wolfram.com/language/ref/LibraryFunctionLoad.en.md"
  - 
    title: "LibraryFunctionUnload"
    link: "https://reference.wolfram.com/language/ref/LibraryFunctionUnload.en.md"
  - 
    title: "LibraryFunctionDeclaration"
    link: "https://reference.wolfram.com/language/ref/LibraryFunctionDeclaration.en.md"
  - 
    title: "FindLibrary"
    link: "https://reference.wolfram.com/language/ref/FindLibrary.en.md"
  - 
    title: "Function"
    link: "https://reference.wolfram.com/language/ref/Function.en.md"
  - 
    title: "Compile"
    link: "https://reference.wolfram.com/language/ref/Compile.en.md"
  - 
    title: "CompiledFunction"
    link: "https://reference.wolfram.com/language/ref/CompiledFunction.en.md"
  - 
    title: "Install"
    link: "https://reference.wolfram.com/language/ref/Install.en.md"
related_tutorials: 
  - 
    title: "Library Link User Guide"
    link: "https://reference.wolfram.com/language/LibraryLink/tutorial/Overview.en.md"
  - 
    title: "Library Structure"
    link: "https://reference.wolfram.com/language/LibraryLink/tutorial/LibraryStructure.en.md"
  - 
    title: "Interacting with the Wolfram System"
    link: "https://reference.wolfram.com/language/LibraryLink/tutorial/InteractionWithWolframLanguage.en.md"
---
# LibraryFunction

LibraryFunction[args] represents a function that has been loaded from a Wolfram Library.

## Details

* ``LibraryFunction`` is returned by functions such as ``LibraryFunctionLoad``.

* A ``LibraryFunction`` object can be used the same way as a pure function.

* The function represented by ``LibraryFunction`` runs in the same process as the Wolfram Language kernel.

* The function represented by ``LibraryFunction`` can share data with the Wolfram Language kernel.

* Functions in libraries loaded by ``LibraryFunctionLoad`` can make callbacks to the Wolfram Language*.*

* The function represented by ``LibraryFunction`` is unloaded when the Wolfram Language kernel exits.

* [``LibraryFunctionUnload``](https://reference.wolfram.com/language/ref/LibraryFunctionUnload.en.md) unloads a [``LibraryFunction``](https://reference.wolfram.com/language/ref/LibraryFunction.en.md) so that it can no longer be used.

* The default name of functions declared with ``LibraryFunctionDeclaration`` is ``LibraryFunction["externalName"]`` for use in compiled code.

* ``LibraryFunction["externalName"]`` can be used in compiled code to call certain functions from the C standard library.

* ``Information`` for a ``LibraryFunction`` may include the following properties:

|                 |                                    |
| --------------- | ---------------------------------- |
| "ArgumentTypes" | types of arguments                 |
| "File"          | name of the library file           |
| "Function"      | name of the loaded function        |
| "ReturnType"    | return type of the loaded function |

## Examples (1)

### Basic Examples (1)

Load a function from a sample library:

```wl
In[1]:= fun = LibraryFunctionLoad["demo", "demo_I_I", {Integer}, Integer]

Out[1]=
LibraryFunction["/Applications/Wolfram/14.3.0.W.app/Contents/SystemFiles/Links/LibraryLink/LibraryR\
esources/MacOSX-ARM64/demo.dylib", "demo_I_I", {Integer}, Integer]
```

Call the function:

```wl
In[2]:= fun[10]

Out[2]= 11
```

## See Also

* [`LibraryFunctionLoad`](https://reference.wolfram.com/language/ref/LibraryFunctionLoad.en.md)
* [`LibraryFunctionUnload`](https://reference.wolfram.com/language/ref/LibraryFunctionUnload.en.md)
* [`LibraryFunctionDeclaration`](https://reference.wolfram.com/language/ref/LibraryFunctionDeclaration.en.md)
* [`FindLibrary`](https://reference.wolfram.com/language/ref/FindLibrary.en.md)
* [`Function`](https://reference.wolfram.com/language/ref/Function.en.md)
* [`Compile`](https://reference.wolfram.com/language/ref/Compile.en.md)
* [`CompiledFunction`](https://reference.wolfram.com/language/ref/CompiledFunction.en.md)
* [`Install`](https://reference.wolfram.com/language/ref/Install.en.md)

## Tech Notes

* [Library Link User Guide](https://reference.wolfram.com/language/LibraryLink/tutorial/Overview.en.md)
* [Library Structure](https://reference.wolfram.com/language/LibraryLink/tutorial/LibraryStructure.en.md)
* [Interacting with the Wolfram System](https://reference.wolfram.com/language/LibraryLink/tutorial/InteractionWithWolframLanguage.en.md)

## Related Guides

* [Wolfram LibraryLink](https://reference.wolfram.com/language/guide/LibraryLink.en.md)
* [C/C++ Language Interface](https://reference.wolfram.com/language/guide/CLanguageInterface.en.md)
* [Calling External Programs](https://reference.wolfram.com/language/guide/CallingExternalPrograms.en.md)
* [External Language Interfaces](https://reference.wolfram.com/language/guide/ExternalLanguageInterfaces.en.md)
* [External Operations](https://reference.wolfram.com/language/guide/ExternalOperations.en.md)

## History

* [Introduced in 2010 (8.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn80.en.md) \| [Updated in 2019 (12.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn120.en.md)