[Mono-osx] Beginner - Very Simple P/Invoke Example?
mike cann
mike.cann at gmail.com
Mon Jan 4 10:55:17 EST 2010
Okay thats great cheers guys. Ill check this out later on and report back.
Mike
2010/1/4 Duane Wandless <duane at wandless.net>
> I recommend the dllmap approach when embedding. I could not get any of the
> environment variables to be correctly set and read at runtime. I'd set it
> during the app load routine, init mono and mono would fail to find the
> library. If I set the environment variable prior to launching the app mono
> could find the library. Using the dllmap I'm able to set at runtime where
> my dylib is located, which is within the app itself.
>
> Duane
>
> On Mon, Jan 4, 2010 at 3:40 AM, Michael Hutchinson <
> m.j.hutchinson at gmail.com> wrote:
>
>> On Sun, Jan 3, 2010 at 5:15 PM, cannyshammy <mike.cann at gmail.com> wrote:
>> > Im new to Mono development tho I have done a fair bit of XNA stuff. For
>> this
>> > current project however I need to catch system-wide input events so I
>> need
>> > some native code for that.
>> >
>> > Im trying to get a very simple P/Invoke example working on OSX. My C
>> looks
>> > like:
>> <snip>
>> > But it throws me the following error:
>> >
>> > Unhandled Exception: System.DllNotFoundException: libXCodeMono.dylib
>> > at (wrapper managed-to-native) SimpleMacMonoHook.MacHook:myMethod (int)
>> > at SimpleMacMonoHook.MacHook..ctor () [0x00006] in
>>
>> My guess would be that when loading dynamic libraries, MacOS isn't
>> looking in the directory your program's in. Try setting
>> DYLD_FALLBACK_LIBRARY_PATH to your program's directory in your launch
>> script.
>>
>> AFAIK the "done thing" for library paths on Mac is to use absolute
>> paths, with some variables - the following explains this:
>>
>> http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/dyld.1.html
>>
>> With Mono, I'd use dllmaps and DYLD_FALLBACK_LIBRARY_PATH.
>>
>> --
>> Michael Hutchinson
>> http://mjhutchinson.com
>> _______________________________________________
>> Mono-osx mailing list
>> Mono-osx at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-osx
>>
>
>
--
Mike Cann
http://www.mikecann.co.uk/
http://www.artificialgames.co.uk/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-osx/attachments/20100104/861db678/attachment.html
More information about the Mono-osx
mailing list