Created
August 14, 2012 14:59
-
-
Save mauricio/3350045 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading; | |
namespace Integration.Mac | |
{ | |
public class CommonRunLoop | |
{ | |
static IntPtr runLoopReference; | |
public static IntPtr CommonRunLoopReference { | |
get { | |
return runLoopReference; | |
} | |
} | |
static CommonRunLoop() { | |
AutoResetEvent lockObj = new AutoResetEvent (true); | |
Thread runLoop = new Thread (delegate() { | |
runLoopReference = CFRunLoopGetCurrent (); | |
lockObj.Set (); | |
CFRunLoopRun (); | |
}); | |
runLoop.IsBackground = true; | |
runLoop.Name = "Common-Sync-Run-Loop"; | |
lockObj.WaitOne(); | |
} | |
[DllImport ("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation")] | |
extern static IntPtr CFRunLoopGetCurrent (); | |
[DllImport ("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation")] | |
extern static IntPtr CFRunLoopGetMain (); | |
[DllImport ("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation")] | |
extern static void CFRunLoopRun (); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Building Solution: calling-native-code-mono (Debug) | |
Building: calling-native-code-mono (Debug) | |
Performing main compilation... | |
/Library/Frameworks/Mono.framework/Versions/2.10.9/bin/dmcs /noconfig "/out:/Users/mauricio/Projects/calling-native-code-mono/bin/Debug/calling-native-code-mono.dll" "/r:/Library/Frameworks/Mono.framework/Versions/2.10.9/lib/mono/4.0/System.dll" "/r:/Library/Frameworks/Mono.framework/Versions/2.10.9/lib/mono/4.0/System.Core.dll" /nologo /warn:4 /debug:full /optimize- /codepage:utf8 "/define:DEBUG" /t:library "/Users/mauricio/Projects/calling-native-code-mono/CommonRunLoop.cs" "/Users/mauricio/Projects/calling-native-code-mono/AssemblyInfo.cs" | |
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object | |
at Mono.CSharp.EmitContext.Emit (OpCode opcode, Mono.CSharp.MethodSpec method) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.New.Emit (Mono.CSharp.EmitContext ec, IMemoryLocation target) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.VariableReference.EmitAssign (Mono.CSharp.EmitContext ec, Mono.CSharp.Expression source, Boolean leave_copy, Boolean prepare_for_load) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Assign.Emit (Mono.CSharp.EmitContext ec, Boolean is_statement) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Assign.EmitStatement (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.BlockVariableDeclaration.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Statement.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Block.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Block.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.ExplicitBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.ToplevelBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Constructor.Emit () [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.TypeContainer.EmitType () [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.ModuleContainer.Emit () [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.AssemblyDefinition.Emit () [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0 | |
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object | |
at Mono.CSharp.EmitContext.Emit (OpCode opcode, Mono.CSharp.MethodSpec method) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.New.Emit (Mono.CSharp.EmitContext ec, IMemoryLocation target) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.VariableReference.EmitAssign (Mono.CSharp.EmitContext ec, Mono.CSharp.Expression source, Boolean leave_copy, Boolean prepare_for_load) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Assign.Emit (Mono.CSharp.EmitContext ec, Boolean is_statement) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Assign.EmitStatement (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.BlockVariableDeclaration.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Statement.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Block.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Block.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.ExplicitBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.ToplevelBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Constructor.Emit () [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.TypeContainer.EmitType () [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.ModuleContainer.Emit () [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.AssemblyDefinition.Emit () [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0 | |
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object | |
at Mono.CSharp.EmitContext.Emit (OpCode opcode, Mono.CSharp.MethodSpec method) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.New.Emit (Mono.CSharp.EmitContext ec, IMemoryLocation target) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.VariableReference.EmitAssign (Mono.CSharp.EmitContext ec, Mono.CSharp.Expression source, Boolean leave_copy, Boolean prepare_for_load) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Assign.Emit (Mono.CSharp.EmitContext ec, Boolean is_statement) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Assign.EmitStatement (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.BlockVariableDeclaration.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Statement.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Block.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Block.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.ExplicitBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.ToplevelBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Constructor.Emit () [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.TypeContainer.EmitType () [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.ModuleContainer.Emit () [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.AssemblyDefinition.Emit () [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0 | |
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object | |
at Mono.CSharp.EmitContext.Emit (OpCode opcode, Mono.CSharp.MethodSpec method) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.New.Emit (Mono.CSharp.EmitContext ec, IMemoryLocation target) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.VariableReference.EmitAssign (Mono.CSharp.EmitContext ec, Mono.CSharp.Expression source, Boolean leave_copy, Boolean prepare_for_load) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Assign.Emit (Mono.CSharp.EmitContext ec, Boolean is_statement) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Assign.EmitStatement (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.BlockVariableDeclaration.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Statement.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Block.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Block.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.ExplicitBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.ToplevelBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Constructor.Emit () [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.TypeContainer.EmitType () [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.ModuleContainer.Emit () [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.AssemblyDefinition.Emit () [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 | |
at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0 | |
Build complete -- 1 error, 0 warnings | |
---------------------- Done ---------------------- | |
Build: 1 error, 0 warnings |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment