# Create a native plug-in for iOS

> Create a native plug-in for your iOS project and import it into Unity.

Create a native plug-in for iOS and import it into your Unity project.

## Define an extern method

For each native function you want to call, define an `extern` method in the C# file as follows:

> **Note:**
>
> Use `"__Internal"` as the library name when your native code is built into the same binary as the Unity runtime. For example, a statically linked plug-in. If your native code is in a dynamic library (`.dylib`), use the library name instead. For example, `"MyPlugin"` for `MyPlugin.dylib`.

```c#
[DllImport ("__Internal")]

private static extern float FooPluginFunction();
```

## Use C linkage to prevent name mangling

If you use C++ (`.cpp`) or Objective-C++ (`.mm`) for your plug-in, declare functions with C linkage to avoid name mangling:

```lang-cs
extern "C" {
  float FooPluginFunction();
}
```

C or Objective-C plug-ins don’t require C linkage as they don’t use name mangling.

If you use Swift for your plug-in, use the `@_cdecl` attribute to export functions with C linkage and avoid name mangling:

```lang-swift
@_cdecl("FooPluginFunction")
func AnythingFooPluginFunction() -> Float {
    return 3.14
}
```

## Import your native plug-in into your Unity project

Add your native source files to your project's `Assets` folder.

## Configure plug-in settings

Use the Inspector window to configure your plug-in so Unity includes it in the generated Xcode project. Refer to [Configure a plug-in for iOS with the Inspector window](/engine/6000.6/manual/platform-specific/iphone/ios-developing/plugins-for-ios/ios-native-plugin-automated-integration.md) for details.

## Additional resources

* [Call native plug-ins for iOS](/engine/6000.6/manual/platform-specific/iphone/ios-developing/plugins-for-ios/ios-native-plugin-call.md)
