[Mono-osx] Problem building and using a Cocoa .dylib

Hess, Philip J pjhess at purdue.edu
Mon Jan 30 18:44:17 UTC 2012

That looks okay to me.

Does the error message really say "DLL not found"? If it's not finding your library, it seems as though it should say ".dylib not found" (even though the library extension is just a convention, that is what you've named it).

Also, is your library my.dylib or libmy.dylib? Normally when you create dynamic or static library with Xcode the resulting file name willl start with "lib".

I haven't worked with Mono in a couple years, so I'm unfamiliar with what happens if you mix 32-bit and 64-bit stuff. You could check both your .dylib and the one that loads for differences in architecture:

At console:

file my.dylib



From: mono-osx-bounces at lists.ximian.com [mono-osx-bounces at lists.ximian.com] On Behalf Of tlapse [tlapse at gmail.com]
Sent: Monday, January 30, 2012 12:28 PM
To: mono-osx at lists.ximian.com
Subject: [Mono-osx] Problem building and using a Cocoa .dylib

I created a simple Cocoa .dylib in Xcode and place it in the same folder as
my app, but I'm not able to use it from C#.

[DllImport("my.dylib", EntryPoint = "myProc", SetLastError = true,
CallingConvention = CallingConvention.Cdecl)]

This raises a DLL not found exception, but if I put some other .dylib in the
same place, it is found. So it's apparently not a search path problem.

I buily the lib in Xcode for 32-bit intel, mac osx 10.6

Any ideas?

View this message in context: http://mono.1490590.n4.nabble.com/Problem-building-and-using-a-Cocoa-dylib-tp4341716p4341716.html
Sent from the Mono - OSX mailing list archive at Nabble.com.
Mono-osx mailing list
Mono-osx at lists.ximian.com

More information about the Mono-osx mailing list