<p>Yes, Mono on MacOS is currently only 32-bit so can only P/Invoke 32-bit libraries. </p>
<p><blockquote type="cite">On Feb 13, 2010 1:59 PM, &quot;Kibiz0r&quot; &lt;<a href="mailto:kibiz0r@gmail.com">kibiz0r@gmail.com</a>&gt; wrote:<br><br>Here&#39;s one I can successfully p/invoke:<div><br></div><div><div>otool -L /opt/local/lib/liballeg.dylib </div>
<div>/opt/local/lib/liballeg.dylib:</div><div><span style="white-space:pre">        </span>/opt/local/liballeg-4.2.dylib (compatibility version 4.2.0, current version 4.2.3)</div>

<div><span style="white-space:pre">        </span>/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 15.0.0)</div><div><span style="white-space:pre">        </span>/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 152.0.0)</div>
<p><font color="#500050"><br>/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current v...</font></p><p><font color="#500050"><br>/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.0.0)</font></p>
<div><span style="white-space:pre">        </span>/System/Library/Frameworks/CoreAudio.framework/Versions/A/CoreAudio (compatibility version 1.0.0, current version 1.0.0)</div><div><span style="white-space:pre">        </span>/System/Library/Frameworks/AudioUnit.framework/Versions/A/AudioUnit (compatibility version 1.0.0, current version 1.0.0)</div>


<div><span style="white-space:pre">        </span>/System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox (compatibility version 1.0.0, current version 1.0.0)</div><div><span style="white-space:pre">        </span>/System/Library/Frameworks/QuickTime.framework/Versions/A/QuickTime (compatibility version 1.0.0, current version 1591.3.0)</div>


<div><span style="white-space:pre">        </span>/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 227.0.0)</div><div><span style="white-space:pre">        </span>/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 44.0.0)</div>


<div><span style="white-space:pre">        </span>/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 550.13.0)</div><div><span style="white-space:pre">        </span>/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 38.0.0)</div>


<div><span style="white-space:pre">        </span>/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 751.14.0)</div><p><font color="#500050"><br>/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, curren...</font></p>
<div>Here&#39;s the output from running my app with logging (good to know how to do!):</div><div><br></div><div><div><div>MONO_LOG_LEVEL=&quot;debug&quot; MONO_LOG_MASK=&quot;dll&quot; mono AllegroSharp.Sandbox.exe</div>

<div>Mono-INFO: DllImport attempting to load: &#39;/usr/local/lib/liballegro-4.9.16.dylib&#39;.</div><div>Mono-INFO: DllImport loading location: &#39;lib/usr/local/lib/liballegro-4.9.16.dylib.dylib&#39;.</div><div>Mono-INFO: DllImport error loading library: &#39;dlopen(lib/usr/local/lib/liballegro-4.9.16.dylib.dylib, 9): image not found&#39;.</div>


<div>Mono-INFO: DllImport loading location: &#39;lib/usr/local/lib/<a href="http://liballegro-4.9.16.dylib.so" target="_blank">liballegro-4.9.16.dylib.so</a>&#39;.</div><div>Mono-INFO: DllImport error loading library: &#39;dlopen(lib/usr/local/lib/<a href="http://liballegro-4.9.16.dylib.so" target="_blank">liballegro-4.9.16.dylib.so</a>, 9): image not found&#39;.</div>


<div>Mono-INFO: DllImport loading location: &#39;lib/usr/local/lib/liballegro-4.9.16.dylib.bundle&#39;.</div><div>Mono-INFO: DllImport error loading library: &#39;dlopen(lib/usr/local/lib/liballegro-4.9.16.dylib.bundle, 9): image not found&#39;.</div>


<div>Mono-INFO: DllImport loading library: &#39;./lib/usr/local/lib/liballegro-4.9.16.dylib.dylib&#39;.</div><div>Mono-INFO: DllImport error loading library &#39;dlopen(./lib/usr/local/lib/liballegro-4.9.16.dylib.dylib, 9): image not found&#39;.</div>


<div>Mono-INFO: DllImport loading library: &#39;./lib/usr/local/lib/<a href="http://liballegro-4.9.16.dylib.so" target="_blank">liballegro-4.9.16.dylib.so</a>&#39;.</div><div>Mono-INFO: DllImport error loading library &#39;dlopen(./lib/usr/local/lib/<a href="http://liballegro-4.9.16.dylib.so" target="_blank">liballegro-4.9.16.dylib.so</a>, 9): image not found&#39;.</div>


<div>Mono-INFO: DllImport loading library: &#39;./lib/usr/local/lib/liballegro-4.9.16.dylib.bundle&#39;.</div><div>Mono-INFO: DllImport error loading library &#39;dlopen(./lib/usr/local/lib/liballegro-4.9.16.dylib.bundle, 9): image not found&#39;.</div>


<div>Mono-INFO: DllImport loading: &#39;/usr/local/lib/liballegro-4.9.16.dylib&#39;.</div><div>Mono-INFO: DllImport error loading library &#39;dlopen(/usr/local/lib/liballegro-4.9.16.dylib, 9): no suitable image found.  Did find:</div>


<div><span style="white-space:pre">        </span>/usr/local/lib/liballegro-4.9.16.dylib: mach-o, but wrong architecture&#39;.</div><div>Mono-INFO: DllImport loading location: &#39;lib/usr/local/lib/liballegro-4.9.16.dylib.dylib&#39;.</div>


<div>Mono-INFO: DllImport error loading library: &#39;dlopen(lib/usr/local/lib/liballegro-4.9.16.dylib.dylib, 9): image not found&#39;.</div><div>Mono-INFO: DllImport loading location: &#39;lib/usr/local/lib/<a href="http://liballegro-4.9.16.dylib.so" target="_blank">liballegro-4.9.16.dylib.so</a>&#39;.</div>


<div>Mono-INFO: DllImport error loading library: &#39;dlopen(lib/usr/local/lib/<a href="http://liballegro-4.9.16.dylib.so" target="_blank">liballegro-4.9.16.dylib.so</a>, 9): image not found&#39;.</div><div>Mono-INFO: DllImport loading location: &#39;lib/usr/local/lib/liballegro-4.9.16.dylib.bundle&#39;.</div>


<div>Mono-INFO: DllImport error loading library: &#39;dlopen(lib/usr/local/lib/liballegro-4.9.16.dylib.bundle, 9): image not found&#39;.</div><div>Mono-INFO: DllImport loading library: &#39;./lib/usr/local/lib/liballegro-4.9.16.dylib.dylib&#39;.</div>


<div>Mono-INFO: DllImport error loading library &#39;dlopen(./lib/usr/local/lib/liballegro-4.9.16.dylib.dylib, 9): image not found&#39;.</div><div>Mono-INFO: DllImport loading library: &#39;./lib/usr/local/lib/<a href="http://liballegro-4.9.16.dylib.so" target="_blank">liballegro-4.9.16.dylib.so</a>&#39;.</div>


<div>Mono-INFO: DllImport error loading library &#39;dlopen(./lib/usr/local/lib/<a href="http://liballegro-4.9.16.dylib.so" target="_blank">liballegro-4.9.16.dylib.so</a>, 9): image not found&#39;.</div><div>Mono-INFO: DllImport loading library: &#39;./lib/usr/local/lib/liballegro-4.9.16.dylib.bundle&#39;.</div>


<div>Mono-INFO: DllImport error loading library &#39;dlopen(./lib/usr/local/lib/liballegro-4.9.16.dylib.bundle, 9): image not found&#39;.</div><div>Mono-INFO: DllImport loading: &#39;lib/usr/local/lib/liballegro-4.9.16.dylib&#39;.</div>


<div>Mono-INFO: DllImport error loading library &#39;dlopen(lib/usr/local/lib/liballegro-4.9.16.dylib, 9): image not found&#39;.</div><div><br></div><div>(AllegroSharp.Sandbox.exe:288): Mono-WARNING **: DllImport unable to load library &#39;dlopen(lib/usr/local/lib/liballegro-4.9.16.dylib, 9): image not found&#39;.</div>


<div>Mono-INFO: DllImport attempting to load: &#39;/usr/local/lib/liballegro-4.9.16.dylib&#39;.</div><div>Mono-INFO: DllImport loading location: &#39;lib/usr/local/lib/liballegro-4.9.16.dylib.dylib&#39;.</div><div>Mono-INFO: DllImport error loading library: &#39;dlopen(lib/usr/local/lib/liballegro-4.9.16.dylib.dylib, 9): image not found&#39;.</div>


<div>Mono-INFO: DllImport loading location: &#39;lib/usr/local/lib/<a href="http://liballegro-4.9.16.dylib.so" target="_blank">liballegro-4.9.16.dylib.so</a>&#39;.</div><div>Mono-INFO: DllImport error loading library: &#39;dlopen(lib/usr/local/lib/<a href="http://liballegro-4.9.16.dylib.so" target="_blank">liballegro-4.9.16.dylib.so</a>, 9): image not found&#39;.</div>


<div>Mono-INFO: DllImport loading location: &#39;lib/usr/local/lib/liballegro-4.9.16.dylib.bundle&#39;.</div><div>Mono-INFO: DllImport error loading library: &#39;dlopen(lib/usr/local/lib/liballegro-4.9.16.dylib.bundle, 9): image not found&#39;.</div>


<div>Mono-INFO: DllImport loading library: &#39;./lib/usr/local/lib/liballegro-4.9.16.dylib.dylib&#39;.</div><div>Mono-INFO: DllImport error loading library &#39;dlopen(./lib/usr/local/lib/liballegro-4.9.16.dylib.dylib, 9): image not found&#39;.</div>


<div>Mono-INFO: DllImport loading library: &#39;./lib/usr/local/lib/<a href="http://liballegro-4.9.16.dylib.so" target="_blank">liballegro-4.9.16.dylib.so</a>&#39;.</div><div>Mono-INFO: DllImport error loading library &#39;dlopen(./lib/usr/local/lib/<a href="http://liballegro-4.9.16.dylib.so" target="_blank">liballegro-4.9.16.dylib.so</a>, 9): image not found&#39;.</div>


<div>Mono-INFO: DllImport loading library: &#39;./lib/usr/local/lib/liballegro-4.9.16.dylib.bundle&#39;.</div><div>Mono-INFO: DllImport error loading library &#39;dlopen(./lib/usr/local/lib/liballegro-4.9.16.dylib.bundle, 9): image not found&#39;.</div>


<div>Mono-INFO: DllImport loading: &#39;/usr/local/lib/liballegro-4.9.16.dylib&#39;.</div><div>Mono-INFO: DllImport error loading library &#39;dlopen(/usr/local/lib/liballegro-4.9.16.dylib, 9): no suitable image found.  Did find:</div>


<div><span style="white-space:pre">        </span>/usr/local/lib/liballegro-4.9.16.dylib: mach-o, but wrong architecture&#39;.</div><div>Mono-INFO: DllImport loading location: &#39;lib/usr/local/lib/liballegro-4.9.16.dylib.dylib&#39;.</div>


<div>Mono-INFO: DllImport error loading library: &#39;dlopen(lib/usr/local/lib/liballegro-4.9.16.dylib.dylib, 9): image not found&#39;.</div><div>Mono-INFO: DllImport loading location: &#39;lib/usr/local/lib/<a href="http://liballegro-4.9.16.dylib.so" target="_blank">liballegro-4.9.16.dylib.so</a>&#39;.</div>


<div>Mono-INFO: DllImport error loading library: &#39;dlopen(lib/usr/local/lib/<a href="http://liballegro-4.9.16.dylib.so" target="_blank">liballegro-4.9.16.dylib.so</a>, 9): image not found&#39;.</div><div>Mono-INFO: DllImport loading location: &#39;lib/usr/local/lib/liballegro-4.9.16.dylib.bundle&#39;.</div>


<div>Mono-INFO: DllImport error loading library: &#39;dlopen(lib/usr/local/lib/liballegro-4.9.16.dylib.bundle, 9): image not found&#39;.</div><div>Mono-INFO: DllImport loading library: &#39;./lib/usr/local/lib/liballegro-4.9.16.dylib.dylib&#39;.</div>


<div>Mono-INFO: DllImport error loading library &#39;dlopen(./lib/usr/local/lib/liballegro-4.9.16.dylib.dylib, 9): image not found&#39;.</div><div>Mono-INFO: DllImport loading library: &#39;./lib/usr/local/lib/<a href="http://liballegro-4.9.16.dylib.so" target="_blank">liballegro-4.9.16.dylib.so</a>&#39;.</div>


<div>Mono-INFO: DllImport error loading library &#39;dlopen(./lib/usr/local/lib/<a href="http://liballegro-4.9.16.dylib.so" target="_blank">liballegro-4.9.16.dylib.so</a>, 9): image not found&#39;.</div><div>Mono-INFO: DllImport loading library: &#39;./lib/usr/local/lib/liballegro-4.9.16.dylib.bundle&#39;.</div>


<div>Mono-INFO: DllImport error loading library &#39;dlopen(./lib/usr/local/lib/liballegro-4.9.16.dylib.bundle, 9): image not found&#39;.</div><div>Mono-INFO: DllImport loading: &#39;lib/usr/local/lib/liballegro-4.9.16.dylib&#39;.</div>


<div>Mono-INFO: DllImport error loading library &#39;dlopen(lib/usr/local/lib/liballegro-4.9.16.dylib, 9): image not found&#39;.</div><div><br></div><div>(AllegroSharp.Sandbox.exe:288): Mono-WARNING **: DllImport unable to load library &#39;dlopen(lib/usr/local/lib/liballegro-4.9.16.dylib, 9): image not found&#39;.</div>


<div><br></div><div>Unhandled Exception: System.DllNotFoundException: /usr/local/lib/liballegro-4.9.16.dylib</div><div>  at (wrapper managed-to-native) AllegroSharp.Allegro:GetVersion ()</div><div>  at AllegroSharp.Sandbox.MainClass.Main (System.String[] args) [0x00000] in &lt;filename unknown&gt;:0</div>


<div><br></div><div>I&#39;m assuming wrong architecture means the library was built 64-bit but should be 32. (or vice-versa?) I&#39;m on snow leopard. This sounds more like a build system issue than a p/invoke issue, so I&#39;ll pursue this with the Allegro developers. Thanks for your help.</div>


</div></div><p><font color="#500050"><br><br>On Sat, Feb 13, 2010 at 4:40 AM, Laurent Etiemble &lt;<a href="mailto:laurent.etiemble@gmail.com">laurent.etiemble@gmail.com</a>&gt; wrote:<br>&gt;<br>&gt; Hello,<br>&gt;...</font></p>
</div>
<br>_______________________________________________<br>
Mono-osx mailing list<br>
<a href="mailto:Mono-osx@lists.ximian.com">Mono-osx@lists.ximian.com</a><br>
<a href="http://lists.ximian.com/mailman/listinfo/mono-osx" target="_blank">http://lists.ximian.com/mailman/listinfo/mono-osx</a><br>
<br></blockquote></p>