[Mono-osx] Cocoa dylib entry point not found
Michael Hutchinson
m.j.hutchinson at gmail.com
Wed Jun 13 18:41:46 UTC 2012
On 12 June 2012 19:57, tlapse <tlapse at gmail.com> wrote:
> I'm sure I'm missing something simple; but I'm a Windows .Net person not a
> MAC person.
>
> In the .h file of my simple cocoa dynamic library I declare a method
> "qlrtsend"
>
> [i]#import <Foundation/Foundation.h>
> #import <Cocoa/Cocoa.h>
> @interface libQLRT : NSObject
> {
> }
> - (NSString*) qlrtsend: (NSString*) request;
> @end[/i]
>
> Then in my MonoMac application I reference it
>
> [DllImport("/Applications/MyApp/libQLRT.dylib")]
> static extern NSString qlrtsend(NSString request);
> .
> .
> .
> NSString response = qlrtsend(new NSString("test"));
>
> It finds the lib, but I get an EntryPointNotFound error.
>
> What magic must I do to declare a method in a Cocoa library so I can
> reference it in MonoMac?
> Is this documented anywhere?
You cannot P/Invoke Objective-C methods; they are not C APIs.
You can use the binding generator to generate bindings:
http://www.mono-project.com/MonoMac#Binding_Cocoa
Or you can manually use the Messaging APIs to send an Obj-C message to
the object - see
http://mjhutchinson.com/journal/2011/06/monomac_video_ndc_2011 for
some info.
--
Michael Hutchinson
http://mjhutchinson.com
More information about the Mono-osx
mailing list