I'm trying to create a custom marshaler using Mono.Posix.dll, but I'm having
problems with both linking and usage. I'm using MonoDevelop 2.6 RC2, but I
've tried these steps with earlier versions and on another Mac. All give the
same results.

First, the linking. I created a new solution/project based on the "iPhone
Window-based Project". I then added a reference to Mono.Posix.dll by
selecting the following file:

   \Library\Frameworks\Mono.framework\Libraries\mono\2.0\Mono.Posix.dll

I then edited Main.cs as follows:

- commented out "UIApplication.Main (args);" from the Main method
- added a "using Mono.Unix;"
- added the following two statements to the Main method
      IntPtr heap = UnixMarshal.AllocHeap(1024);
      UnixMarshal.FreeHeap(heap);

When I try to build the program for Debug|iPhone, the build fails with the
"mtouch failed with no output (1)" error message. After much banging of the
head, I finally figured out that this is a linking problem. If I edit the
project settings and change the "Linker behavior" option from "Link SDK
assemblies only" to "Don't link", the build succeeds. This seems like a bug
to me.

Now onto the runtime problem. If I now run the above program, it gets an
exception as soon as it tries to execute the AllocHeap line (i.e. the first
line that uses Mono.Posix.dll). The exception is:

   Unable to resolve pinvoke method
'Mono.Unix.Native.Stdlib:GetDefaultSignal ()'

So, can anybody tell me what I'm doing wrong? Have I referenced the correct
DLL/library? Am I missing some other DLL/library? Any help would be greatly
appreciated. Thanks.


--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/Problems-using-Mono-Posix-dll-tp3764104p3764104.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to