[Mono-list] [Mono-dev] DllImport on Mac

Jonathan Mitchell jonathan at mugginsoft.com
Mon Oct 20 08:51:33 UTC 2014



> On 20 Oct 2014, at 01:13, Brandon Perry <bperry.volatile at gmail.com> wrote:
> 
> I cannot for the life of my figure out how to reference this library on mac for a DllImport. I have tried an absolute path as well as every permutation of the library name as possible since DllImport will auto detect the extension.
> 
> Any thoughts on referencing a dylib with DllImport? Thanks!

On OS X I use a config file based dll map to map System.Data.SQLite to the required dylib in my app bundle.

http://www.mono-project.com/docs/advanced/pinvoke/dllmap/

Note the map goes in the dll config not the app config so you may need to consider this relative to your situation.

System.Data.SQLIte.dll.config:

<dllmap dll="sqlite3" target="../Mono//sqlite3/libsqlite3.8.5.dylib" os="!windows”/>

I also build and run a 64 bit mono without problems.

Jonathan



More information about the Mono-list mailing list