# DllNotFoundException (676481)

**URL:** <https://discussions.unity.com/t/dllnotfoundexception-676481/676481>\
**Category:** Desktop\
**Tags:** macOS\
**Created:** [September 8, 2017, 8:15am UTC](https://discussions.unity.com/t/dllnotfoundexception-676481/676481 "2017-09-08T08:15:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dawidk](https://avatars.discourse-cdn.com/v4/letter/d/a8b319/32.png) [@dawidk](https://discussions.unity.com/u/dawidk)\
**Post date:** [September 8, 2017, 8:15am UTC](https://discussions.unity.com/t/dllnotfoundexception-676481/676481/1 "2017-09-08T08:15:43Z")

</div>

Hey folks,

I am having trouble with loading mac framework to unity. In`Applications/Unity.app/Contents/MonoBleedingEdge/etc/mono/config` I have added

```csharp
    <dllmap dll="libpcsclite.so.1" os="osx" target="/System/Library/Frameworks/PCSC.framework/PCSC" />
    <dllmap dll="libdl.so.2" os="osx" target="libSystem.B.Dylib" />

```

but when I run

```csharp
 [DllImport("libpcsclite.so.1")]
        private static extern IntPtr SCardConnect(
            [In] IntPtr hContext,
            [In] byte[] szReader,
            [In] IntPtr dwShareMode,
            [In] IntPtr dwPreferredProtocols,
            [Out] out IntPtr phCard,
            [Out] out IntPtr pdwActiveProtocol);

```

I am getting `DllNotFoundException: PCSC`  
Here is log from editor

```csharp
Fallback handler could not load library /Applications/Unity/Unity.app/Contents/Frameworks/Mono/lib/libPCSC
Fallback handler could not load library /Applications/Unity/Unity.app/Contents/Frameworks/Mono/lib/libPCSC.dylib
Fallback handler could not load library /Applications/Unity/Unity.app/Contents/Frameworks/Mono/lib/libPCSC.so
Fallback handler could not load library /Applications/Unity/Unity.app/Contents/Frameworks/Mono/lib/libPCSC.bundle
Fallback handler could not load library /Applications/Unity/Unity.app/Contents/Frameworks/Mono/lib/PCSC
Fallback handler could not load library /Applications/Unity/Unity.app/Contents/Frameworks/Mono/lib/libPCSC
Fallback handler could not load library /Applications/Unity/Unity.app/Contents/Frameworks/Mono/lib/libPCSC.dylib
Fallback handler could not load library /Applications/Unity/Unity.app/Contents/Frameworks/Mono/lib/libPCSC.so
Fallback handler could not load library /Applications/Unity/Unity.app/Contents/Frameworks/Mono/lib/libPCSC.bundle
Fallback handler could not load library /Applications/Unity/Unity.app/Contents/Frameworks/Mono/lib/libPCSC
Fallback handler could not load library /Applications/Unity/Unity.app/Contents/Frameworks/Mono/lib/libPCSC
Fallback handler could not load library /Applications/Unity/Unity.app/Contents/Frameworks/Mono/lib/libPCSC.dylib
Fallback handler could not load library /Applications/Unity/Unity.app/Contents/Frameworks/Mono/lib/libPCSC.so
Fallback handler could not load library /Applications/Unity/Unity.app/Contents/Frameworks/Mono/lib/libPCSC.bundle
Fallback handler could not load library /Applications/Unity/Unity.app/Contents/Frameworks/Mono/lib/PCSC
Fallback handler could not load library /Applications/Unity/Unity.app/Contents/Frameworks/Mono/lib/libPCSC
Fallback handler could not load library /Applications/Unity/Unity.app/Contents/Frameworks/Mono/lib/libPCSC.dylib
Fallback handler could not load library /Applications/Unity/Unity.app/Contents/Frameworks/Mono/lib/libPCSC.so
Fallback handler could not load library /Applications/Unity/Unity.app/Contents/Frameworks/Mono/lib/libPCSC.bundle
Fallback handler could not load library /Applications/Unity/Unity.app/Contents/Frameworks/Mono/lib/libPCSC
DllNotFoundException: PCSC
  at (wrapper managed-to-native) PCSC.Interop.Unix.PCSCliteAPI:SCardEstablishContext (intptr,intptr,intptr,intptr&)
  at PCSC.Interop.Unix.PCSCliteAPI.EstablishContext (PCSC.SCardScope dwScope, System.IntPtr pvReserved1, System.IntPtr pvReserved2, System.IntPtr& phContext)

```

Seems like unity is unable to load the framework. It works in Xamarin, but can’t get it to work in Unity. I am using 2017.2b10 with mono 4.6 backend. Any pointers what I do wrong?

---

<div class="post-metadata">

**Author:** ![samizzo](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/samizzo/32/312488_2.png) [@samizzo](https://discussions.unity.com/u/samizzo)\
**Post date:** [September 23, 2017, 7:23am UTC](https://discussions.unity.com/t/dllnotfoundexception-676481/676481/2 "2017-09-23T07:23:11Z")

</div>

It doesn’t look like it’s respecting the path you have set there in the mono config file. Looking at the mono docs on pinvoke [here](http://www.mono-project.com/docs/advanced/pinvoke/) under “Mac OS X Framework and .dylib Search Path” they mention the paths that loading will look in, but don’t specifically mention that you can put a path in there. So maybe try without the path?

-sam
